mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-21 11:59:24 +02:00
Add mock to master script
This commit is contained in:
parent
4d3db8782c
commit
a6e8141c1b
1 changed files with 17 additions and 13 deletions
|
@ -707,17 +707,19 @@ class TestMigrations(TestCase):
|
||||||
def run_master_script(self):
|
def run_master_script(self):
|
||||||
# noqa here (E501) because splitting this up makes it
|
# noqa here (E501) because splitting this up makes it
|
||||||
# confusing to read.
|
# confusing to read.
|
||||||
with patch(
|
mock_client = MockSESClient()
|
||||||
"registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no_exit", # noqa
|
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||||
return_value=True,
|
with patch(
|
||||||
):
|
"registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no_exit", # noqa
|
||||||
call_command(
|
return_value=True,
|
||||||
"master_domain_migrations",
|
):
|
||||||
runMigrations=True,
|
call_command(
|
||||||
migrationDirectory=self.test_data_file_location,
|
"master_domain_migrations",
|
||||||
migrationJSON=self.migration_json_filename,
|
runMigrations=True,
|
||||||
disablePrompts=True,
|
migrationDirectory=self.test_data_file_location,
|
||||||
)
|
migrationJSON=self.migration_json_filename,
|
||||||
|
disablePrompts=True,
|
||||||
|
)
|
||||||
|
|
||||||
def compare_tables(
|
def compare_tables(
|
||||||
self,
|
self,
|
||||||
|
@ -1030,7 +1032,8 @@ class TestMigrations(TestCase):
|
||||||
# this is one of the email addresses in data/test_contacts.txt
|
# this is one of the email addresses in data/test_contacts.txt
|
||||||
output_stream = StringIO()
|
output_stream = StringIO()
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", MockSESClient):
|
mock_client = MockSESClient()
|
||||||
|
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||||
# also have to re-point the logging handlers to output_stream
|
# also have to re-point the logging handlers to output_stream
|
||||||
with less_console_noise(output_stream):
|
with less_console_noise(output_stream):
|
||||||
call_command("send_domain_invitations", "testuser@gmail.com", stdout=output_stream)
|
call_command("send_domain_invitations", "testuser@gmail.com", stdout=output_stream)
|
||||||
|
@ -1051,7 +1054,8 @@ class TestMigrations(TestCase):
|
||||||
# these are two email addresses in data/test_contacts.txt
|
# these are two email addresses in data/test_contacts.txt
|
||||||
output_stream = StringIO()
|
output_stream = StringIO()
|
||||||
|
|
||||||
with boto3_mocking.clients.handler_for("sesv2", MockSESClient):
|
mock_client = MockSESClient()
|
||||||
|
with boto3_mocking.clients.handler_for("sesv2", mock_client):
|
||||||
# also have to re-point the logging handlers to output_stream
|
# also have to re-point the logging handlers to output_stream
|
||||||
with less_console_noise(output_stream):
|
with less_console_noise(output_stream):
|
||||||
call_command(
|
call_command(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue