Re-factor the ORM tests to use randomized fake data

- create `*Factory` classes with fakerboy and faker that generate
  randomized instances of the ORM models
- add new pytest marker: "db" are the integration tests involving the
  database whereas "e2e" will be all other integration tests
- streamline the docstrings in the ORM models
This commit is contained in:
Alexander Hess 2020-12-29 14:37:37 +01:00
commit 78dba23d5d
Signed by: alexander
GPG key ID: 344EA5AB10D868E0
19 changed files with 1092 additions and 721 deletions

View file

@ -89,6 +89,8 @@ extend-ignore =
# Comply with black's style.
# Source: https://github.com/psf/black/blob/master/docs/compatible_configs.md#flake8
E203, W503, WPS348,
# Allow underscores in numbers.
WPS303,
# f-strings are ok.
WPS305,
# Classes should not have to specify a base class.
@ -139,14 +141,24 @@ per-file-ignores =
tests/*.py:
# Type annotations are not strictly enforced.
ANN0, ANN2,
# The `Meta` class inside the factory_boy models do not need a docstring.
D106,
# `assert` statements are ok in the test suite.
S101,
# The `random` module is not used for cryptography.
S311,
# Shadowing outer scopes occurs naturally with mocks.
WPS442,
# Modules may have many test cases.
WPS202,WPS204,WPS214,
# Do not check for Jones complexity in the test suite.
WPS221,
# No overuse of string constants (e.g., '__version__').
WPS226,
# We do not care about the number of "# noqa"s in the test suite.
WPS402,
# Allow closures.
WPS430,
# Numbers are normal in test cases as expected results.
WPS432,
@ -166,6 +178,7 @@ show-source = true
# wemake-python-styleguide's settings
# ===================================
allowed-domain-names =
data,
obj,
param,
result,
@ -274,4 +287,5 @@ console_output_style = count
env =
TESTING=true
markers =
e2e: integration tests, incl., for example, tests touching the database
db: tests touching the database
e2e: non-db integration tests