mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 11:38:39 +02:00
Merge pull request #3607 from cisagov/es/fixtures-quickfix
Fixtures quickfix [local testing]
This commit is contained in:
commit
e3fdb4de56
1 changed files with 1 additions and 15 deletions
|
@ -315,25 +315,11 @@ class DomainRequestFixture:
|
|||
cls._create_domain_requests(users)
|
||||
|
||||
@classmethod
|
||||
def _create_domain_requests(cls, users, total_requests=None): # noqa: C901
|
||||
def _create_domain_requests(cls, users): # noqa: C901
|
||||
"""Creates DomainRequests given a list of users."""
|
||||
total_domain_requests_to_make = len(users) # 100000
|
||||
|
||||
# Check if the database is already populated with the desired
|
||||
# number of entries.
|
||||
# (Prevents re-adding more entries to an already populated database,
|
||||
# which happens when restarting Docker src)
|
||||
total_existing_requests = DomainRequest.objects.count()
|
||||
|
||||
domain_requests_to_create = []
|
||||
if total_requests and total_requests <= total_existing_requests:
|
||||
total_domain_requests_to_make = total_requests - total_existing_requests
|
||||
if total_domain_requests_to_make >= 0:
|
||||
DomainRequest.objects.filter(
|
||||
id__in=list(DomainRequest.objects.values_list("pk", flat=True)[:total_domain_requests_to_make])
|
||||
).delete()
|
||||
if total_domain_requests_to_make == 0:
|
||||
return
|
||||
|
||||
for user in users:
|
||||
for request_data in cls.DOMAINREQUESTS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue