Merge lp:~aanand0071/postorius/postorius into lp:postorius

Proposed by Aanand
Status: Needs review
Proposed branch: lp:~aanand0071/postorius/postorius
Merge into: lp:postorius
Diff against target: 72 lines (+58/-0)
1 file modified
src/postorius/tests/mailman_api_tests/test_list_delete.py (+58/-0)
To merge this branch: bzr merge lp:~aanand0071/postorius/postorius
Reviewer Review Type Date Requested Status
Terri Needs Fixing
Review via email: mp+251907@code.launchpad.net

Description of the change

Added test_list_delete.py

To post a comment you must log in.
Terri (terriko) wrote :

I'm getting "MailmanConnectionError: Could not connect to Mailman API" when I run this test, and only this test, so I think there may be something incorrect in the config here. Can you run against the latest version of mailman and debug?

review: Needs Fixing
Terri (terriko) wrote :

Also, great thought on fixing all those permissions in the css/png/js -- if you want to submit that as a separate patch, I'd be happy to merge it while you debug the test case.

Unmerged revisions

204. By Aanand on 2015-03-04

added test_list_delete.py

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/postorius/doc/settings.py' (properties changed: +x to -x)
2=== modified file 'src/postorius/static/postorius/css/style.css' (properties changed: +x to -x)
3=== modified file 'src/postorius/static/postorius/img/icons/minus.png' (properties changed: +x to -x)
4=== modified file 'src/postorius/static/postorius/img/icons/plus.png' (properties changed: +x to -x)
5=== modified file 'src/postorius/static/postorius/img/mailman_logo.png' (properties changed: +x to -x)
6=== modified file 'src/postorius/static/postorius/js/libs/modernizr-1.7.min.js' (properties changed: +x to -x)
7=== modified file 'src/postorius/static/postorius/js/plugins.js' (properties changed: +x to -x)
8=== modified file 'src/postorius/static/postorius/js/script.js' (properties changed: +x to -x)
9=== added file 'src/postorius/tests/mailman_api_tests/test_list_delete.py'
10--- src/postorius/tests/mailman_api_tests/test_list_delete.py 1970-01-01 00:00:00 +0000
11+++ src/postorius/tests/mailman_api_tests/test_list_delete.py 2015-03-05 11:21:00 +0000
12@@ -0,0 +1,58 @@
13+from __future__ import (
14+ absolute_import, division, print_function, unicode_literals)
15+
16+
17+import six
18+import logging
19+
20+from django.core.urlresolvers import reverse
21+from django.test import Client, SimpleTestCase
22+from django.test.utils import override_settings
23+from urllib2 import HTTPError
24+from django.contrib.auth.models import User
25+from postorius.utils import get_client
26+from postorius.tests import MM_VCR
27+
28+
29+logger = logging.getLogger(__name__)
30+vcr_log = logging.getLogger('vcr')
31+vcr_log.setLevel(logging.WARNING)
32+
33+
34+API_CREDENTIALS = {'MAILMAN_API_URL': 'http://localhost:9001',
35+ 'MAILMAN_USER': 'restadmin',
36+ 'MAILMAN_PASS': 'restpass'}
37+
38+
39+@override_settings(**API_CREDENTIALS)
40+class ListDeletePageTest(SimpleTestCase):
41+ """Tests for the list index page."""
42+
43+ @MM_VCR.use_cassette('test_list_delete.yaml')
44+ def setUp(self):
45+ self.mm_client = get_client()
46+ self.client = Client()
47+ try:
48+ self.domain = self.mm_client.create_domain('example.com')
49+ except HTTPError:
50+ self.domain = self.mm_client.get_domain('example.com')
51+ self.foo_list = self.mm_client.get_list('foo@example.com')
52+ self.superuser=User.objects.create_superuser('sup','sup@example.com','pswd')
53+
54+ @MM_VCR.use_cassette('test_list_delete.yaml')
55+ def test_list_delete_contains_no_list(self):
56+ self.client.login(username='sup',password='pswd')
57+ response1 = self.client.get(reverse('list_delete',args=['foo@example.com']),follow=True)
58+ self.assertEqual(response1.status_code,200)
59+ self.client.post(revrse('list_delete',args=['foo@example.com']),follow=True)
60+ self.assertRedirects(response1,reverse('list_index'),status_code=302)
61+ response2=self.client.get(reverse('list_delete'))
62+ self.asserEqual(len(response2.context['lists']), 0)
63+
64+
65+
66+ @MM_VCR.use_cassette('test_list_delete.yaml')
67+ def tearDown(self):
68+ self.superuser.delete()
69+ self.client.delete_domain('example.org')
70+
71
72=== modified file 'testing/test_settings.py' (properties changed: +x to -x)

Subscribers

People subscribed via source and target branches