mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-23 17:51:03 +02:00
Fixtures for approved domains
This commit is contained in:
parent
ab1eb0ead1
commit
96b95bae8a
2 changed files with 25 additions and 1 deletions
|
@ -107,6 +107,10 @@ class DomainApplicationFixture:
|
|||
"status": "investigating",
|
||||
"organization_name": "Example - In Investigation",
|
||||
},
|
||||
{
|
||||
"status": "investigating",
|
||||
"organization_name": "Example - Approved",
|
||||
},
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
@ -249,3 +253,22 @@ class DomainApplicationFixture:
|
|||
cls._set_many_to_many_relations(da, app)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
|
||||
class DomainFixture(DomainApplicationFixture):
|
||||
|
||||
"""Create one domain and permissions on it for each user."""
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
try:
|
||||
users = list(User.objects.all()) # force evaluation to catch db errors
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
return
|
||||
|
||||
for user in users:
|
||||
# approve one of each users investigating status domains
|
||||
application = DomainApplication.objects.filter(creator=user, status=DomainApplication.INVESTIGATING).last()
|
||||
logger.debug(f"Approving {application} for {user}")
|
||||
application.approve()
|
||||
application.save()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue