mockdb tests now more efficient

This commit is contained in:
David Kennedy 2024-07-04 11:00:03 -04:00
parent a6f7cc6f02
commit 36985353c2
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 40 additions and 16 deletions

View file

@ -29,10 +29,15 @@ from .common import MockDb, MockEppLib, less_console_noise, get_time_aware_date
class CsvReportsTest(MockDb):
"""Tests to determine if we are uploading our reports correctly"""
"""Tests to determine if we are uploading our reports correctly.
These tests use MockDb, which runs setUpClass and tearDownClass to handle
creation of fake domain data.
setUp and tearDown in this class set up client and factory.
This is for efficiency purposes when running tests, but
also means that care must be taken to clean up within each test.
"""
def setUp(self):
"""Create fake domain data"""
super().setUp()
self.client = Client(HTTP_HOST="localhost:8080")
self.factory = RequestFactory()
@ -196,11 +201,12 @@ class CsvReportsTest(MockDb):
class ExportDataTest(MockDb, MockEppLib):
def setUp(self):
super().setUp()
def tearDown(self):
super().tearDown()
"""Test the ExportData class from csv_export.
These tests use MockDb, which runs setUpClass and tearDownClass.
setUp and tearDown in this test run from MockEppLib to set up EPP mocks.
This is for efficiency purposes when running tests, but
also means that care must be taken to clean up within each test.
"""
def test_export_domains_to_writer_security_emails_and_first_ready(self):
"""Test that export_domains_to_writer returns the