Article content tests for Sitecomber platform
- pip install sitecomber-article-tests
- Add 'sitecomber_article_tests.tests' to your INSTALLED_APPS list in your project's settings.py
- Restart server to see new tests available in site settings
Returns successful when an article title and text is found using the Newspaper library (https://github.com/codelucas/newspaper/)
You can specify a language other than english in the Site's test settings JSON:
{
"lang": "en"
}
See the Newspaper library for a list of supported languages.
NOTE: The article parsing functionality here is used for the tests below.
Returns successful when no placeholder words are found in the article title or article body.
You can provide custom placeholder words by specifying "placeholder_words" in the Site's test settings JSON:
{
"placeholder_words": [
"lorem",
"ipsum",
"tk",
"todo",
"tbd"
],
"lang": "en"
}
The default list is ["lorem", "ipsum"]
Returns approximate read time as "INFO" based on 265WPM estimate
Uses https://pypi.org/project/readtime/
Returns successful when no spelling errors are found in the article title or article body.
Uses https://github.com/barrust/pyspellchecker for spell-checking
You can provide custom words to the dictionary by specifying "known_words" in the Site's test settings JSON:
{
"known_words": [
"lectus",
"faucibus",
"amet"
],
"lang": "en"
}
To use test functions, run the following:
virtualenv venv -p python3
source venv/bin/activate
pip install -r requirements.txt
# This will run a general unit test:
python unit_tests.py
# This will run an interactive console to test specific words:
python test_word.py