|
@ -7,9 +7,12 @@ from .settings import SAPL_APPS |
|
|
|
|
|
|
|
|
pytestmark = pytest.mark.django_db |
|
|
pytestmark = pytest.mark.django_db |
|
|
|
|
|
|
|
|
|
|
|
sapl_appconfs = [apps.get_app_config(n) for n in SAPL_APPS] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_charfiled_textfield(): |
|
|
def test_charfiled_textfield(): |
|
|
for model in apps.get_models(): |
|
|
for app in sapl_appconfs: |
|
|
|
|
|
for model in app.get_models(): |
|
|
fields = model._meta.local_fields |
|
|
fields = model._meta.local_fields |
|
|
for field in fields: |
|
|
for field in fields: |
|
|
if isinstance(field, (CharField, TextField)): |
|
|
if isinstance(field, (CharField, TextField)): |
|
@ -18,13 +21,12 @@ def test_charfiled_textfield(): |
|
|
field.attname, |
|
|
field.attname, |
|
|
type(field).__name__, |
|
|
type(field).__name__, |
|
|
field.null) |
|
|
field.null) |
|
|
raise AssertionError(msg) |
|
|
assert not field.null, msg |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_str_sanity(): |
|
|
def test_str_sanity(): |
|
|
# this simply a sanity check |
|
|
# this simply a sanity check |
|
|
# __str__ semantics is not considered and should be tested separetely |
|
|
# __str__ semantics is not considered and should be tested separetely |
|
|
sapl_appconfs = [apps.get_app_config(n) for n in SAPL_APPS] |
|
|
|
|
|
for app in sapl_appconfs: |
|
|
for app in sapl_appconfs: |
|
|
for model in app.get_models(): |
|
|
for model in app.get_models(): |
|
|
obj = mommy.prepare(model) |
|
|
obj = mommy.prepare(model) |
|
|