Ashish has proposed merging lp:~coolyashish/postorius/tests into lp:postorius.
Requested reviews:
Mailman Coders (mailman-coders)
Related bugs:
Bug #1414352 in Postorius: "Improve code coverage by adding tests"
https://bugs.launchpad.net/postorius/+bug/1414352
For more details, see:
https://code.launchpad.net/~coolyashish/postorius/tests/+merge/256620
--
Your team Mailman Coders is requested to review the proposed merge of
lp:~coolyashish/postorius/tests into lp:postorius.
=== modified file 'src/postorius/doc/settings.py' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/css/style.css' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/img/icons/minus.png' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/img/icons/plus.png' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/img/mailman_logo.png' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/js/libs/modernizr-1.7.min.js' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/js/plugins.js' (properties changed: +x to -x)
=== modified file 'src/postorius/static/postorius/js/script.js' (properties changed: +x to -x)
=== modified file 'src/postorius/tests/mailman_api_tests/test_list_members.py'
--- src/postorius/tests/mailman_api_tests/test_list_members.py 2015-04-10 21:06:10 +0000
+++ src/postorius/tests/mailman_api_tests/test_list_members.py 2015-04-17 07:05:28 +0000
@@ -174,3 +174,54 @@
@MM_VCR.use_cassette('test_list_members_new_moderator_added.yaml')
def test_new_moderator_added(self):
self.assertTrue(u'[email protected]' in self.foo_list.moderators)
+
+
+@override_settings(**API_CREDENTIALS)
+class MassSubscribeTest(SimpleTestCase):
+ """Tests for the mass subscribe list page.
+
+ Tests creation of members.
+ """
+
+ @MM_VCR.use_cassette('test_list_mass_subscribe.yaml')
+ def setUp(self):
+ self.client = Client()
+ try:
+ self.domain = get_client().create_domain('example.com')
+ except HTTPError:
+ self.domain = get_client().get_domain('example.com')
+ self.foo_list = self.domain.create_list('foo')
+ self.su = User.objects.create_superuser(
+ 'su', '[email protected]', 'pwd')
+ # login and post new moderator data to url
+ self.client.login(username='su', password='pwd')
+ valid_emails = "[email protected]\[email protected]\[email protected]"
+ invalid_emails = "a.com\[email protected]\[email protected]"
+ self.client.post(
+ reverse('mass_subscribe', args=('[email protected]', )),
+ {'emails': valid_emails + "\n" + invalid_emails})
+ moderators = self.foo_list.moderators
+
+ @MM_VCR.use_cassette('test_list_mass_subscribe.yaml')
+ def tearDown(self):
+ self.foo_list.delete()
+ self.su.delete()
+
+ @MM_VCR.use_cassette('test_list_mass_subscribe.yaml')
+ def test_valid_email_subscribe(self):
+ """ Tests for subscription of all valid emails """
+ self.assertTrue(u'[email protected]' in self.foo_list.members)
+ self.assertTrue(u'[email protected]' in self.foo_list.members)
+ self.assertTrue(u'[email protected]' in self.foo_list.members)
+
+ @MM_VCR.use_cassette('test_list_mass_subscribe.yaml')
+ def test_invalid_email_not_subscribe(self):
+ """ Tests for no subscription of invalid emails """
+ self.assertTrue(u'a.com' not in self.foo_list.members)
+
+ @MM_VCR.use_cassette('test_list_mass_subscribe.yaml')
+ def test_duplicate_email_not_subscribe(self):
+ """ Tests for no duplicate subscription of emails """
+ self.assertEqual(3,len(self.foo_list.members))
+
+
=== modified file 'testing/test_settings.py' (properties changed: +x to -x)
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders