| 1 | """ |
| 2 | Tests for configurable fields |
| 3 | """ |
| 4 | import importlib |
| 5 | |
| 6 | from django.core.exceptions import ImproperlyConfigured |
| 7 | |
| 8 | import pytest |
| 9 | |
| 10 | from organizations import fields |
| 11 | |
| 12 | |
| 13 | def test_misconfigured_autoslug_cannot_import(settings): |
| 14 | settings.ORGS_SLUGFIELD = "not.AModel" |
| 15 | with pytest.raises(ImproperlyConfigured): |
| 16 | importlib.reload(fields) |
| 17 | |
| 18 | |
| 19 | def test_misconfigured_autoslug_incorrect_class(settings): |
| 20 | settings.ORGS_SLUGFIELD = "autoslug.AutoSlug" |
| 21 | with pytest.raises(ImproperlyConfigured): |
| 22 | importlib.reload(fields) |
| 23 | |
| 24 | |
| 25 | def test_misconfigured_autoslug_bad_notation(settings): |
| 26 | settings.ORGS_SLUGFIELD = "autoslug.AutoSlugField" |
| 27 | importlib.reload(fields) |