diff --git a/src/postorius/tests/mailman_api_tests/test_domain_new.py b/src/postorius/tests/mailman_api_tests/test_domain_new.py index 23ae745..5cb975e 100644 --- a/src/postorius/tests/mailman_api_tests/test_domain_new.py +++ b/src/postorius/tests/mailman_api_tests/test_domain_new.py @@ -59,5 +59,7 @@ 'web_host': 'http://example.com', 'description': 'A new Domain'} response = self.client.post(reverse('domain_new'), post_data) - self.assertHasErrorMessage(response) + self.assertContains(response, 'Please check the errors below') + self.assertContains(response, 'Please enter a valid domain name') + # self.assertHasErrorMessage(response) self.assertEquals(response.status_code, 200) 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 d4f8733..1a4420b 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_new.py +++ b/src/postorius/tests/mailman_api_tests/test_list_new.py @@ -59,6 +59,5 @@ 'description': 'A new list.'} response = self.client.post(reverse('list_new'), post_data) self.assertEquals(response.status_code, 200) - self.assertHasErrorMessage(response) + # self.assertHasErrorMessage(response) self.assertContains(response, 'Please enter a valid listname') - diff --git a/src/postorius/tests/mailman_api_tests/test_user.py b/src/postorius/tests/mailman_api_tests/test_user.py index e2fb190..1fbe8da 100644 --- a/src/postorius/tests/mailman_api_tests/test_user.py +++ b/src/postorius/tests/mailman_api_tests/test_user.py @@ -140,11 +140,10 @@ self.client.login(username='user', password='testpass') self.foo_list.subscribe(self.user.email, pre_verified=True, pre_confirmed=True, pre_approved=True) - response = self.client.get(reverse('user_list_options', + response = self.client.get(reverse('user_list_options', args=[self.foo_list.list_id])) self.assertEquals(response.status_code, 200) self.assertIsInstance(response.context['form'], UserPreferences) self.assertIsInstance(response.context['change_subscription_form'], ChangeSubscriptionForm) - diff --git a/src/postorius/tests/test_domain_view.py b/src/postorius/tests/test_domain_view.py index 2b7ad1e..8009925 100644 --- a/src/postorius/tests/test_domain_view.py +++ b/src/postorius/tests/test_domain_view.py @@ -20,7 +20,6 @@ from postorius.forms import DomainNew - class DomainViewTest(TestCase): def setUp(self): diff --git a/src/postorius/views/domain.py b/src/postorius/views/domain.py index 69aaa09..ef6f9f3 100644 --- a/src/postorius/views/domain.py +++ b/src/postorius/views/domain.py @@ -19,7 +19,6 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required, user_passes_test -from django.core.urlresolvers import reverse from django.shortcuts import render, redirect from django.utils.translation import gettext as _ try: @@ -65,7 +64,7 @@ messages.error(request, _('Please check the errors below')) else: form = DomainNew() - return render(request, 'postorius/domain/new.html', {'form': form,}) + return render(request, 'postorius/domain/new.html', {'form': form}) @login_required @@ -84,4 +83,5 @@ messages.error(request, _('The domain could not be deleted: %s' % e.msg)) return redirect("domain_index") - return render(request, 'postorius/domain/confirm_delete.html', {'domain': domain,}) + return render(request, 'postorius/domain/confirm_delete.html', + {'domain': domain}) diff --git a/src/postorius/views/list.py b/src/postorius/views/list.py index b6c5766..c5a64be 100644 --- a/src/postorius/views/list.py +++ b/src/postorius/views/list.py @@ -96,13 +96,14 @@ query = context['query'] = request.GET['q'] if "*" not in query: query = '*{}*'.format(query) + # Proxy the find_members method to insert the query - method = lambda count, page: mailing_list.find_members( - query, count=count, page=page) + def find_method(count, page): + return mailing_list.find_members(query, count=count, page=page) else: - method = mailing_list.get_member_page + find_method = mailing_list.get_member_page context['members'] = utils.paginate( - request, method, count=request.GET.get('count', 25), + request, find_method, count=request.GET.get('count', 25), paginator_class=utils.MailmanPaginator) if len(mailing_list.members) == 0: context['empty_error'] = _('List has no Subscribers')