Testing and demo data
The smoke test that checks the governance rules, and the seeder that fills a demo database.
Two scripts live in social_media_ai_workforce/tools/. They run against a live database through odoo-bin shell. They are not imported by the module and never run on install.
The smoke test#
smoke_test.py asserts the governance behaviour end to end, so a regression fails loudly instead of printing a warning.
odoo-bin shell -c odoo.conf -d <db> --no-http < social_media_ai_workforce/tools/smoke_test.py
It checks 23 things, including:
- submitting moves a draft to Pending Approval;
- a non-manager cannot approve, a manager can and is recorded as the approver;
- an unapproved post cannot be published by a non-manager;
- an Approval Required agent is blocked from publishing on its own, and the block is recorded in the audit trail;
- a Semi-Autonomous agent still needs a human for media;
- the daily cap is enforced, and a paused agent cannot act;
- scheduling rejects a past date, and a manager can schedule a future one;
- the scheduled-publishing query finds a due post, and the scheduled action is registered and active;
- users and managers cannot edit the audit trail;
- the trail keeps an agent's name after the agent is renamed;
- a 400-character post warns for X's 280 limit.
Each line prints PASS, FAIL or ERROR. It rolls back when it finishes, so it leaves no records behind and is safe on a database you care about.
Demo data#
seed_demo.py fills a demo database with a plausible operation: connected channels, ten posts spread across every workflow state, engagement figures on the published ones, and an audit trail that includes a blocked autonomous publish.
odoo-bin shell -c odoo.conf -d <db> --no-http < social_media_ai_workforce/tools/seed_demo.py
Caution
seed_demo.py commits. It is keyed by record name, so re-running updates the existing demo records instead of duplicating them, but never run it against production.
The Docker Route A runs it for you on first start. The Route B installer runs it only if you pass --seed.
The documentation module's tests#
smarterp_docs ships tests too:
# No Odoo needed: the renderer, the file reader and the search ranking
python3 smarterp_docs/tools/run_offline_tests.py
# With Odoo: database and HTTP tests as well
odoo-bin -d <db> -i smarterp_docs --test-tags smarterp_docs --stop-after-init
See How it works.
The Social Marketing module#
It has demo data (Acme accounts, hashtags, a template, a campaign, and posts in each state) that loads when you create a database with demo data enabled. Because every account starts in Test Mode, you can exercise scheduling and the scheduled action without any credentials.