Public bug reported:
Mailman Core and Postorius have sets of tests, but could use more extensive test coverage. This bug is meant to be a repeatable bug suitable for new contributors (e.g. prospective Google Summer of Code Students). In short: find a piece of Postorius or Mailman Core that isn't yet tested and write a test (or set of tests) for it.
Contributors wishing to work on Mailman Core should look at START.rst and DATABASE.rst for more information about setting up tests.
For Postorius, Florian is working on vcrpy test integration, so new tests can use that format.
Links to documentation and examples much appreciated to update this bug!
** Affects: mailman Importance: Undecided Status: New
** Affects: postorius Importance: Undecided Status: New
** Tags: beginner-friendly easy mailman3 repeatable test
** Tags added: easy mailman3
** Also affects: mailman Importance: Undecided Status: New
** Description changed:
- Postorius has a set of tests, but it could use more extensive coverage. - This bug is meant to be a repeatable bug suitable for new contributors - (e.g. prospective Google Summer of Code Students). In short: find a - piece of postorius that isn't yet tested and write a test (or set of - tests) for it. + Mailman Core and Postorius have sets of tests, but could use more + extensive test coverage. This bug is meant to be a repeatable bug + suitable for new contributors (e.g. prospective Google Summer of Code + Students). In short: find a piece of Postorius or Mailman Core that + isn't yet tested and write a test (or set of tests) for it.
- Florian is working on vcrpy test integration, so new tests can use that - format. + Contributors wishing to work on Mailman Core should look at START.rst + and DATABASE.rst for more information about setting up tests. + + For Postorius, Florian is working on vcrpy test integration, so new + tests can use that format. + + Links to documentation and examples much appreciated to update this bug!
** Tags added: repeatable
** Branch linked: lp:~flo-fuchs/postorius/testing
vcrpy is now integrated into Postorius.
I updated the documentation, instructions on how to run the tests can be found in (from Postorius' root directory):
src/postorius/docs/development.rst
** Changed in: postorius Status: New => Confirmed
** Changed in: postorius Importance: Undecided => High
This is the current coverage report. We can clearly do better! :-)
Name Stmts Miss Cover Missing ------------------------------------------------------------------ postorius 1 1 0% 19 postorius.auth 0 0 100% postorius.auth.decorators 68 25 63% 30-43, 83, 85, 100-105, 113-116 postorius.context_processors 7 1 86% 30 postorius.doc 0 0 100% postorius.fieldset_forms 37 19 49% 50-59, 68, 74-95 postorius.forms 187 43 77% 52-53, 139, 149-150, 598-599, 602-625, 632-638, 830-836, 849-850 postorius.management 0 0 100% postorius.management.commands 0 0 100% postorius.models 149 42 72% 66-69, 75-83, 90-93, 96-107, 113, 124-127, 135, 138-143, 153, 159, 253 postorius.templatetags 0 0 100% postorius.templatetags.nav_helpers 24 8 67% 29, 38-40, 48-50, 57 postorius.urls 8 0 100% postorius.utils 14 4 71% 32-34, 47 postorius.views 4 0 100% postorius.views.api 28 3 89% 56-58 postorius.views.generic 78 41 47% 35-37, 71-72, 79, 92-93, 96-106, 109-113, 116-126, 130-144 postorius.views.list 354 237 33% 67-68, 78-79, 104-126, 136-148, 182, 197-212, 221-231, 240-241, 246-268, 274-275, 316-326, 337, 341-342, 345, 366-446, 459-470, 481-485, 494-503, 510-519, 526-535, 542-551, 568-613, 628-658 postorius.views.settings 58 33 43% 50, 57-61, 69-87, 95-109 postorius.views.user 222 161 27% 51-68, 72-80, 91-111, 115-134, 148-167, 171-191, 207-209, 222-223, 249-250, 263-269, 282-300, 306-307, 312-318, 325, 335-345, 356-375, 382-386, 400-401 ------------------------------------------------------------------ TOTAL 1239 618 50% ----------------------------------------------------------------------
Hi florian, I modified it a bit.Can you look into it and review it, as I am still getting errors while running it.
** Attachment added: "test_delete_list.py" https://bugs.launchpad.net/postorius/+bug/1414352/+attachment/4323772/+files...
** Attachment removed: "test_delete_list.py" https://bugs.launchpad.net/postorius/+bug/1414352/+attachment/4323772/+files...
from __future__ import ( absolute_import, division, print_function, unicode_literals)
import six import logging
from django.core.urlresolvers import reverse from django.test import Client, SimpleTestCase from django.test.utils import override_settings from urllib2 import HTTPError from django.contrib.auth.models import User from postorius.utils import get_client from postorius.tests import MM_VCR
logger = logging.getLogger(__name__) vcr_log = logging.getLogger('vcr') vcr_log.setLevel(logging.WARNING)
API_CREDENTIALS = {'MAILMAN_API_URL': 'http://localhost:9001', 'MAILMAN_USER': 'restadmin', 'MAILMAN_PASS': 'restpass'}
@override_settings(**API_CREDENTIALS) class ListDeletePageTest(SimpleTestCase): """Tests for the list index page."""
@MM_VCR.use_cassette('test_list_index.yaml') def setUp(self): self.mm_client = get_client() self.client = Client() try: self.domain = self.mm_client.create_domain('example.com') except HTTPError: self.domain = self.mm_client.get_domain('example.com') self.foo_list = self.mm_client.get_list('foo@example.com') self.superuser=User.objects.create_superuser('sup','sup@example.com','pswd')
@MM_VCR.use_cassette('test_list_index.yaml') def test_list_delete_contains_no_list(self): self.client.login(username='sup',password='pswd') response1 = self.client.get(reverse('list_delete',args=['foo@example.com']),follow=True) self.assertEqual(response1.status_code,200) self.client.post(reverse('list_delete',args=['foo@example.com']),follow=True) self.assertRedirects(response1,reverse('list_index'),status_code=302) response2=self.client.get(reverse('list_delete')) self.asserEqual(len(response2.context['lists']), 0)
@MM_VCR.use_cassette('test_list_index.yaml') def tearDown(self): self.superuser.delete() self.client.delete_domain('example.org')
** Changed in: postorius Assignee: (unassigned) => nilmadhab mondal (nilmadhab1994)
Hi florain
I modified tests for forms and currently at 52% coverage. I'm testing on views and I'll try to move it up to 55% soon. Will be sending a pull req soon
** Branch linked: lp:~aanand0071/postorius/postorius
** Changed in: mailman Assignee: (unassigned) => Yash (yashmehrotra95)
** Changed in: mailman Status: New => In Progress
** Branch linked: lp:~coolyashish/postorius/tests
This bug has been moved to the new gitlab repo here: https://gitlab.com/mailman/postorius/issues/2
** Changed in: mailman Assignee: Yash (yashmehrotra95) => (unassigned)