diff --git a/src/postorius/tests/mailman_api_tests/test_archival_options.py b/src/postorius/tests/mailman_api_tests/test_archival_options.py index 386219d..f368d82 100644 --- a/src/postorius/tests/mailman_api_tests/test_archival_options.py +++ b/src/postorius/tests/mailman_api_tests/test_archival_options.py @@ -50,10 +50,7 @@ @MM_VCR.use_cassette('archival_options.yaml') def setUp(self): # Create domain `example.com` in Mailman - try: - example_com = get_client().create_domain('example.com') - except HTTPError: - example_com = get_client().get_domain('example.com') + example_com = get_client().create_domain('example.com') self.m_list = example_com.create_list('test_list') self.test_user = User.objects.create_user( 'test_user', 'test_user@example.com', 'pwd') @@ -65,6 +62,7 @@ self.test_user.delete() self.test_superuser.delete() self.m_list.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('archival_options.yaml') def test_no_access_for_unauthenticated_user(self): @@ -86,10 +84,7 @@ @MM_VCR.use_cassette('test_list_archival_options.yaml') def setUp(self): # Create domain `example.com` in Mailman. - try: - example_com = get_client().create_domain('example.com') - except HTTPError: - example_com = get_client().get_domain('example.com') + example_com = get_client().create_domain('example.com') self.m_list = example_com.create_list('test_list') self.test_user = User.objects.create_user( 'test_user', 'test_user@example.com', 'pwd') @@ -103,6 +98,7 @@ self.test_user.delete() self.test_superuser.delete() self.m_list.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_list_archival_options.yaml') def test_context_contains_list_archivers(self): diff --git a/src/postorius/tests/mailman_api_tests/test_list_index.py b/src/postorius/tests/mailman_api_tests/test_list_index.py index 41f1eea..ba1551c 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_index.py +++ b/src/postorius/tests/mailman_api_tests/test_list_index.py @@ -38,10 +38,7 @@ @MM_VCR.use_cassette('test_list_index.yaml') def setUp(self): - try: - self.domain = get_client().create_domain('example.com') - except HTTPError: - self.domain = get_client().get_domain('example.com') + self.domain = get_client().create_domain('example.com') self.foo_list = self.domain.create_list('foo') self.bar_list = self.domain.create_list('bar') @@ -49,6 +46,7 @@ def tearDown(self): for mlist in get_client().lists: mlist.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_list_index.yaml') def test_list_index_contains_the_lists(self): diff --git a/src/postorius/tests/mailman_api_tests/test_list_members.py b/src/postorius/tests/mailman_api_tests/test_list_members.py index 3a8fc0a..46f706b 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_members.py +++ b/src/postorius/tests/mailman_api_tests/test_list_members.py @@ -44,14 +44,8 @@ @MM_VCR.use_cassette('list_members_access.yaml') def setUp(self): - try: - self.domain = get_client().create_domain('example.com') - except HTTPError: - self.domain = get_client().get_domain('example.com') - try: - self.foo_list = self.domain.create_list('foo') - except HTTPError: - self.foo_list = get_client().get_list('foo.example.com') + self.domain = get_client().create_domain('example.com') + self.foo_list = self.domain.create_list('foo') self.user = User.objects.create_user( 'testuser', 'test@example.com', 'testpass') self.superuser = User.objects.create_superuser( @@ -70,6 +64,7 @@ self.superuser.delete() self.owner.delete() self.moderator.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('list_members_access.yaml') def test_page_not_accessible_if_not_logged_in(self): @@ -120,10 +115,7 @@ @MM_VCR.use_cassette('test_list_members_owner.yaml') def setUp(self): self.mm_client = get_client() - try: - self.domain = self.mm_client.create_domain('example.com') - except HTTPError: - self.domain = self.mm_client.get_domain('example.com') + self.domain = self.mm_client.create_domain('example.com') self.foo_list = self.domain.create_list('foo') self.su = User.objects.create_superuser( 'su', 'su@example.com', 'pwd') @@ -134,6 +126,7 @@ def tearDown(self): self.foo_list.delete() self.su.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_list_members_owner_add_remove.yaml') def test_add_remove_owner(self): @@ -207,10 +200,7 @@ @MM_VCR.use_cassette('test_list_members_add_moderator.yaml') def setUp(self): - try: - self.domain = get_client().create_domain('example.com') - except HTTPError: - self.domain = get_client().get_domain('example.com') + self.domain = get_client().create_domain('example.com') self.foo_list = self.domain.create_list('foo') self.su = User.objects.create_superuser( 'su', 'su@example.com', 'pwd') @@ -226,6 +216,7 @@ def tearDown(self): self.foo_list.delete() self.su.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_list_members_new_moderator_added.yaml') def test_new_moderator_added(self): diff --git a/src/postorius/tests/mailman_api_tests/test_list_new.py b/src/postorius/tests/mailman_api_tests/test_list_new.py index 63a9bda..e835775 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_new.py +++ b/src/postorius/tests/mailman_api_tests/test_list_new.py @@ -45,10 +45,7 @@ self.user = User.objects.create_user('user', 'user@example.com', 'pwd') self.superuser = User.objects.create_superuser('su', 'su@example.com', 'pwd') - try: - self.domain = get_client().create_domain('example.com') - except HTTPError: - self.domain = get_client().get_domain('example.com') + self.domain = get_client().create_domain('example.com') @MM_VCR.use_cassette('test_list_creation.yaml') def tearDown(self): @@ -56,6 +53,7 @@ self.superuser.delete() for mlist in get_client().lists: mlist.delete() + get_client().delete_domain('example.com') def test_permission_denied(self): self.client.login(username='user', password='pwd') diff --git a/src/postorius/tests/mailman_api_tests/test_list_summary.py b/src/postorius/tests/mailman_api_tests/test_list_summary.py index 52aff81..0472659 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_summary.py +++ b/src/postorius/tests/mailman_api_tests/test_list_summary.py @@ -44,10 +44,7 @@ @MM_VCR.use_cassette('test_list_summary.yaml') def setUp(self): self.mmclient = get_client() - try: - domain = self.mmclient.create_domain('example.com') - except HTTPError: - domain = self.mmclient.get_domain('example.com') + domain = self.mmclient.create_domain('example.com') self.foo_list = domain.create_list('foo') try: User.objects.create_user('testuser', 'test@example.com', 'testpass') @@ -61,6 +58,7 @@ for user in self.mmclient.users: user.delete() User.objects.all().delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_list_summary.yaml') def test_list_summary_logged_out(self): diff --git a/src/postorius/tests/mailman_api_tests/test_models.py b/src/postorius/tests/mailman_api_tests/test_models.py index 163e757..33947f6 100644 --- a/src/postorius/tests/mailman_api_tests/test_models.py +++ b/src/postorius/tests/mailman_api_tests/test_models.py @@ -40,10 +40,7 @@ @MM_VCR.use_cassette('test_model.yaml') def setUp(self): self.mmclient = get_client() - try: - self.domain = get_client().create_domain('example.com') - except HTTPError: - self.domain = get_client().get_domain('example.com') + self.domain = get_client().create_domain('example.com') self.foo_list = self.domain.create_list('foo') @MM_VCR.use_cassette('test_model.yaml') @@ -53,6 +50,7 @@ for user in self.mmclient.users: user.delete() User.objects.all().delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_model-2.yaml') def test_mailman_user_not_created_when_flag_is_off(self): diff --git a/src/postorius/tests/mailman_api_tests/test_subscriptions.py b/src/postorius/tests/mailman_api_tests/test_subscriptions.py index 5565ed4..d0f25cf 100644 --- a/src/postorius/tests/mailman_api_tests/test_subscriptions.py +++ b/src/postorius/tests/mailman_api_tests/test_subscriptions.py @@ -40,11 +40,7 @@ @MM_VCR.use_cassette('test_list_subscription.yaml') def setUp(self): - mm_client = get_client() - try: - self.domain = mm_client.create_domain('example.com') - except HTTPError: - self.domain = mm_client.get_domain('example.com') + self.domain = get_client().create_domain('example.com') self.open_list = self.domain.create_list('open_list') # Set subscription policy to open settings = self.open_list.settings @@ -72,6 +68,7 @@ self.open_list.delete() self.mod_list.delete() self.mm_user.delete() + get_client().delete_domain('example.com') @MM_VCR.use_cassette('test_list_subscription_open_primary.yaml') def test_subscribe_open(self):