diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-21 18:03:43 +0000 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-01-21 18:04:15 +0000 |
commit | 5f06e5559c00db759574467c3884a4645346b224 (patch) | |
tree | 8fcd68579d7441823da3e90d913a0694fc65855e /ctrack/users/tests/factories.py | |
parent | 490fc024506c9ed9f9c0b5a4cfbcdecc95127dbe (diff) |
reconfigured Address and Organisation relationship
Diffstat (limited to 'ctrack/users/tests/factories.py')
-rw-r--r-- | ctrack/users/tests/factories.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ctrack/users/tests/factories.py b/ctrack/users/tests/factories.py index 9907945..53584b7 100644 --- a/ctrack/users/tests/factories.py +++ b/ctrack/users/tests/factories.py @@ -6,15 +6,22 @@ from factory import DjangoModelFactory, Faker, post_generation, SubFactory class AddressTypeFactory(DjangoModelFactory): - descriptor = "Primary Address" class Meta: model = AddressType +class OrganisationFactory(DjangoModelFactory): + name = Faker("company", locale="en_GB") + + class Meta: + model = Organisation + + class AddressFactory(DjangoModelFactory): type = SubFactory(AddressTypeFactory) + organisation = SubFactory(OrganisationFactory) line1 = Faker("secondary_address", locale="en_GB") line2 = Faker("street_name", locale="en_GB") line3 = Faker("secondary_address", locale="en_GB") @@ -28,14 +35,6 @@ class AddressFactory(DjangoModelFactory): model = Address -class OrganisationFactory(DjangoModelFactory): - name = Faker("company", locale="en_GB") - address = SubFactory(AddressFactory) - - class Meta: - model = Organisation - - class UserFactory(DjangoModelFactory): username = Faker("user_name") email = Faker("email") |