There are two scripts in this directory:
- test_cms_pages_return_200.py - a test goes through all published & draft versions of pages exposed via CMS API and checks whether those pages can be visited without any error
- generate_page_status_report.py - generates a simple CMS page status report
This module should be placed in tests/periodic_tasks
so it could make use of common helpers.
Unfortunately it would mean that we'd have to have all required env vars (see ./env_vars/env.json)
for Production environment set in CircleCI.
That would be rather far from ideal, thus I've decided to keep these tests in a separate package.
- directory_cms_client
- envparse
- pytest
- requests
- termcolor
- and CMS credentials exported as 2 env vars:
CMS_API_URL
&CMS_API_KEY
You can create a dedicated virtual env or use the same one as for periodic tasks.
If you decide to create a dedicated venv then do so and install all dependencies and export mandatory env vars as follows:
mkvirtualenv -p python3.8 cms_status
pip install directory-cms-client envparse pytest requests termcolor
export CMS_API_URL=https://cms.api.url
export CMS_API_KEY=SECRET_API_KEY
This test goes through all published & draft versions of pages exposed via CMS API and checks whether those pages can be visited without any error.
Moreover, Geckoboard updater parses the result file from this tests and pushes them to Great - CMS stats and dead links
geckoboard.
When in repo's root directory run:
make test_cms_pages_return_200
In case you encounter importing issues set PYTHONPATH
to .
:
cd test_prod_cms_pages
PYTHONPATH=. pytest --capture=no --verbose test_cms_pages_return_200.py
This script generates a simple CMS page status report.
A link to the latest version of such report is published daily on Great - CMS stats and dead links
geckoboard.
To generate a report locally from repo's root directory run:
make cms_page_status_report