Test corpus setup for LatchedLO365om — creates M365 fixture messages via Graph API
Project description
cpmf-lo365om-corpus
Creates test fixture messages in a Microsoft 365 mailbox so that LatchedLO365om consumers can run LatentLithium test cases against real Graph API data.
Quick start — first run
Complete sequence from a fresh machine to a populated mailbox ready for testing.
Copy and adapt the commands; replace the values in < > with your own.
Step 1 — Install uv (skip if already installed)
winget install astral-sh.uv
Step 2 — Get the demo scenario yaml
Download the bundled example into the folder that holds your LatentLithium test data. Run this from your UiPath project root:
mkdir Tests\Corpus
Invoke-WebRequest `
-Uri "https://raw.githubusercontent.com/rpapub/LatchedLO365om.Corpus/main/scenarios/mail-demo.yaml" `
-OutFile Tests\Corpus\mail-demo.yaml
Or copy the file manually from the scenarios/mail-demo.yaml page on GitHub.
Step 3 — Set environment variables
$env:CORPUS_CLIENT_ID = "<application-client-id>" # from your Entra app registration
$env:CORPUS_TENANT_ID = "consumers" # use your tenant ID for work accounts
$env:CORPUS_MAILBOX = "<you@outlook.com>" # dedicated test mailbox
First time? See Entra ID app registration below.
Step 4 — Authenticate (browser opens once; token is cached)
uvx cpmf-lo365om-corpus auth
Step 5 — Create the corpus (type your mailbox address when prompted)
uvx cpmf-lo365om-corpus setup `
--corpus Tests\Corpus\mail-demo.yaml `
--output Tests\Corpus\corpus.json
corpus.json is now next to your scenario yaml. Point LatentLithium at it.
Step 6 — Use corpus.json in your tests
corpus.json contains the immutable IDs, subjects, folder paths, and expected values
for every fixture message. Pass its path to whatever test tooling or automation you are
running against the mailbox.
Step 7 — Tear down when done (type your mailbox address when prompted)
uvx cpmf-lo365om-corpus teardown --manifest Tests\Corpus\corpus.json
Re-run from Step 5 any time you need a fresh corpus.
Install uv
uvx is part of uv — a fast Python package runner.
No Python installation is required separately; uv manages everything.
Windows (recommended):
winget install astral-sh.uv
Or via the uv installer script:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
After installation, restart your terminal and verify:
uvx --version
Linux only — system libraries required
The token cache uses libsecret for encryption on Linux. Without a keyring daemon (e.g. plain WSL), the token is not cached and the OAuth flow runs on every command. See Linux prerequisites at the end of this document for the required system packages.
On macOS and Windows no extra system libraries are needed.
Prerequisites
Microsoft 365 account
A personal (Outlook.com / Hotmail) or work/school (Entra ID) account with
access to a mailbox you can use for testing.
Use a dedicated test mailbox — the setup command clears the target folder on every run.
Entra ID app registration (one-time)
- Go to portal.azure.com → Entra ID → App registrations → New registration
- Name it anything (e.g.
corpus-cli) - Under Redirect URIs → add
http://localhost(platform: Public client / native) - Under API permissions → Add a permission → Microsoft Graph → Delegated →
Mail.ReadandMail.ReadWrite - If your tenant requires it: Grant admin consent
- Copy the Application (client) ID — you will need it below
For personal Outlook.com / Hotmail accounts, use consumers as the tenant ID.
Environment variables
Set these in your shell before running any command, or pass them as flags.
$env:CORPUS_CLIENT_ID = "<application-client-id>"
$env:CORPUS_TENANT_ID = "consumers" # or your Entra tenant ID / domain
$env:CORPUS_MAILBOX = "you@outlook.com" # mailbox where fixtures are created
| Variable | Description |
|---|---|
CORPUS_CLIENT_ID |
App registration client ID |
CORPUS_TENANT_ID |
Tenant ID, domain, or consumers for personal accounts |
CORPUS_MAILBOX |
Target mailbox email address |
Workflow
1 — Authenticate
Opens a browser window for interactive sign-in and caches the token locally.
Acquires Mail.Read scope — read-only, safe to run at any time.
uvx cpmf-lo365om-corpus auth
2 — Create corpus messages
Reads a scenario yaml, creates fixture messages in the mailbox, and writes
corpus.json — the manifest consumed by LatentLithium test cases.
setup requires Mail.ReadWrite and will prompt you to confirm by typing
the mailbox address before proceeding:
This operation will modify the mailbox: you@outlook.com
Type the mailbox address to confirm: _
uvx cpmf-lo365om-corpus setup `
--corpus scenarios\mail-demo.yaml `
--output corpus.json
Re-run setup any time you need a fresh corpus — the target folder is cleared and
re-populated on every run.
3 — Run tests
Open LatentLithium in UiPath Studio and point it at your corpus.json.
4 — Tear down
Deletes all messages created during setup using the IDs recorded in corpus.json.
Also requires Mail.ReadWrite and the same mailbox confirmation.
uvx cpmf-lo365om-corpus teardown --manifest corpus.json
Command reference
uvx cpmf-lo365om-corpus auth [--client-id …] [--tenant-id …]
uvx cpmf-lo365om-corpus setup [--corpus PATH] [--output PATH] [--mailbox …]
uvx cpmf-lo365om-corpus teardown [--manifest PATH]
All flags can be replaced by the corresponding environment variable (see table above).
Scenario yaml
Corpus messages are defined in a scenario yaml file.
See corpus.schema.yaml for the full schema and
scenarios/mail-demo.yaml for a working example.
Linux prerequisites
The token cache is encrypted using libsecret via PyGObject. The following system libraries must be installed before running any command.
Tested on Ubuntu 24.04 (including WSL2):
sudo apt update
sudo apt install libgirepository1.0-dev gir1.2-secret-1 python3-cairo-dev
sudo apt install libcairo2-dev
sudo apt install libgirepository-2.0-dev
These are one-time system-level installs. After installing, uvx will compile and
cache PyGObject automatically on first run.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cpmf_lo365om_corpus-0.1.1.tar.gz.
File metadata
- Download URL: cpmf_lo365om_corpus-0.1.1.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72f4e5a9f83b66534593c80f29234dd5f7f953fe818b59e70697c34fa2fbe100
|
|
| MD5 |
5a3a6de3545e61cbc33411087df44b20
|
|
| BLAKE2b-256 |
678801d6d2e2c0a872431fcf956b7287fc01d258599e7cd986d697971a691f14
|
File details
Details for the file cpmf_lo365om_corpus-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cpmf_lo365om_corpus-0.1.1-py3-none-any.whl
- Upload date:
- Size: 26.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee21dfe8e16b250f36ac82616705cb67db4f1dab70c9cbeaab1e2b091bb68337
|
|
| MD5 |
612262172e088f25a7ed58fc5c9cc3db
|
|
| BLAKE2b-256 |
710eabb44f06968cc59d6268d4fae74784e33dc8c80f4f7d64d134126c55e544
|