Basic test cases

This commit is contained in:
zandercymatics 2023-11-06 11:12:01 -07:00
parent 019b139e8d
commit 661b765f0e
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 32 additions and 19 deletions

View file

@ -1,3 +1,4 @@
from io import StringIO
from django.test import TestCase from django.test import TestCase
from registrar.models import ( from registrar.models import (
@ -10,9 +11,9 @@ from registrar.models import (
) )
from django.core.management import call_command from django.core.management import call_command
from unittest.mock import patch
class TestMigrations(TestCase):
class TestLogins(TestCase):
""" """ """ """
@ -27,16 +28,27 @@ class TestLogins(TestCase):
self.test_contact_filename = "test_contacts.txt" self.test_contact_filename = "test_contacts.txt"
self.test_domain_status_filename = "test_domain_statuses.txt" self.test_domain_status_filename = "test_domain_statuses.txt"
# Files for parsing additional TransitionDomain data
self.test_agency_adhoc_filename = "test_agency_adhoc.txt"
self.test_authority_adhoc_filename = "test_authority_adhoc.txt"
self.test_domain_additional = "test_domain_additional.txt"
self.test_domain_types_adhoc = "test_domain_types_adhoc.txt"
self.test_escrow_domains_daily = "test_escrow_domains_daily"
self.test_organization_adhoc = "test_organization_adhoc.txt"
def tearDown(self): def tearDown(self):
super().tearDown() # Delete domain information
TransitionDomain.objects.all().delete() TransitionDomain.objects.all().delete()
Domain.objects.all().delete() Domain.objects.all().delete()
DomainInvitation.objects.all().delete() DomainInvitation.objects.all().delete()
DomainInformation.objects.all().delete() DomainInformation.objects.all().delete()
# Delete users
User.objects.all().delete() User.objects.all().delete()
UserDomainRole.objects.all().delete() UserDomainRole.objects.all().delete()
def run_load_domains(self): def run_load_domains(self):
with patch('registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no', return_value=True):
call_command( call_command(
"load_transition_domain", "load_transition_domain",
f"{self.test_data_file_location}/{self.test_domain_contact_filename}", f"{self.test_data_file_location}/{self.test_domain_contact_filename}",
@ -48,6 +60,7 @@ class TestLogins(TestCase):
call_command("transfer_transition_domains_to_domains") call_command("transfer_transition_domains_to_domains")
def run_master_script(self): def run_master_script(self):
with patch('registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no', return_value=True):
call_command( call_command(
"master_domain_migrations", "master_domain_migrations",
runMigrations=True, runMigrations=True,