Removed support for perma_fixtures, using the blobal test fixtures instead.
- Legacy-Id: 10228
This commit is contained in:
parent
199f4600d9
commit
4a80395a63
|
@ -41,8 +41,6 @@ def get_cert_files():
|
|||
|
||||
class NomcomViewsTest(TestCase):
|
||||
"""Tests to create a new nomcom"""
|
||||
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
|
||||
perma_fixtures = ['nomcom_templates']
|
||||
|
||||
def check_url_status(self, url, status):
|
||||
response = self.client.get(url)
|
||||
|
@ -745,8 +743,6 @@ class NomcomViewsTest(TestCase):
|
|||
|
||||
class NomineePositionStateSaveTest(TestCase):
|
||||
"""Tests for the NomineePosition save override method"""
|
||||
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
|
||||
perma_fixtures = ['nomcom_templates']
|
||||
|
||||
def setUp(self):
|
||||
self.nomcom_public_keys_dir = os.path.abspath("tmp-nomcom-public-keys-dir")
|
||||
|
@ -786,7 +782,6 @@ class NomineePositionStateSaveTest(TestCase):
|
|||
|
||||
|
||||
class FeedbackTest(TestCase):
|
||||
perma_fixtures = ['nomcom_templates']
|
||||
|
||||
def setUp(self):
|
||||
self.nomcom_public_keys_dir = os.path.abspath("tmp-nomcom-public-keys-dir")
|
||||
|
@ -823,7 +818,6 @@ class FeedbackTest(TestCase):
|
|||
self.assertEqual(check_comments(feedback.comments, comments, self.privatekey_file), True)
|
||||
|
||||
class ReminderTest(TestCase):
|
||||
perma_fixtures = ['nomcom_templates']
|
||||
|
||||
def setUp(self):
|
||||
self.nomcom_public_keys_dir = os.path.abspath("tmp-nomcom-public-keys-dir")
|
||||
|
|
|
@ -322,7 +322,7 @@ RFCDIFF_BASE_URL = "https://www.ietf.org/rfcdiff"
|
|||
TEST_RUNNER = 'ietf.utils.test_runner.IetfTestRunner'
|
||||
|
||||
# Fixtures which will be loaded before testing starts
|
||||
GLOBAL_TEST_FIXTURES = [ 'names','ietf.utils.test_data.make_immutable_base_data' ]
|
||||
GLOBAL_TEST_FIXTURES = [ 'names','ietf.utils.test_data.make_immutable_base_data','nomcom_templates' ]
|
||||
|
||||
TEST_DIFF_FAILURE_DIR = "/tmp/test/failure/"
|
||||
|
||||
|
|
|
@ -269,58 +269,13 @@ class ReverseLazyTest(django.test.TestCase):
|
|||
response = self.client.get('/ipr/update/')
|
||||
self.assertRedirects(response, "/ipr/", status_code=301)
|
||||
|
||||
loaded_fixtures = []
|
||||
|
||||
class TestCase(django.test.TestCase):
|
||||
"""
|
||||
Does basically the same as django.test.TestCase, but if the test database has
|
||||
support for transactions, it loads perma_fixtures before the transaction which
|
||||
surrounds every test. This causes the perma_fixtures to stay in the database
|
||||
after the transaction which surrounds each test is rolled back, which lets us
|
||||
load each preload_fixture only once. However, it requires that all the
|
||||
perma_fixtures are consistent with each other and with all regular fixtures
|
||||
across all applications. You could view the perma_fixtures as on_the_fly
|
||||
initial_data for tests.
|
||||
|
||||
Regular fixtures are re-loaded for each TestCase, as usual.
|
||||
|
||||
We don't flush the database, as that triggers a re-load of initial_data.
|
||||
Does basically the same as django.test.TestCase, but adds asserts for html5 validation.
|
||||
"""
|
||||
|
||||
parser = html5lib.HTMLParser(strict=True)
|
||||
|
||||
def _fixture_setup(self):
|
||||
global loaded_fixtures
|
||||
|
||||
if not connections_support_transactions():
|
||||
if hasattr(self, 'perma_fixtures'):
|
||||
if not hasattr(self, 'fixtures'):
|
||||
self.fixtures = self.perma_fixtures
|
||||
else:
|
||||
self.fixtures += self.perma_fixtures
|
||||
return super(TestCase, self)._fixture_setup()
|
||||
|
||||
# If the test case has a multi_db=True flag, setup all databases.
|
||||
# Otherwise, just use default.
|
||||
if getattr(self, 'multi_db', False):
|
||||
databases = connections
|
||||
else:
|
||||
databases = [DEFAULT_DB_ALIAS]
|
||||
|
||||
for db in databases:
|
||||
if hasattr(self, 'perma_fixtures'):
|
||||
fixtures = [ fixture for fixture in self.perma_fixtures if not fixture in loaded_fixtures ]
|
||||
if fixtures:
|
||||
call_command('loaddata', *fixtures, **{
|
||||
'verbosity': 0,
|
||||
'commit': False,
|
||||
'database': db
|
||||
})
|
||||
loaded_fixtures += fixtures
|
||||
|
||||
super(TestCase, self)._fixture_setup()
|
||||
|
||||
|
||||
def assertValidHTML(self, data):
|
||||
try:
|
||||
self.parser.parse(data)
|
||||
|
|
Loading…
Reference in a new issue