|
1 | | -# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 | | -# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com> |
3 | | -# |
4 | | -# Redistribution and use in source and binary forms, with or without |
5 | | -# modification, are permitted provided that the following conditions |
6 | | -# are met: |
7 | | -# |
8 | | -# * Redistributions of source code must retain the above copyright |
9 | | -# notice, this list of conditions and the following disclaimer. |
10 | | -# |
11 | | -# * Redistributions in binary form must reproduce the above |
12 | | -# copyright notice, this list of conditions and the following |
13 | | -# disclaimer in the documentation and/or other materials provided |
14 | | -# with the distribution. |
15 | | -# |
16 | | -# * Neither the name of the Nokia Corporation and/or its |
17 | | -# subsidiary(-ies) nor the names of its contributors may be used |
18 | | -# to endorse or promote products derived from this software |
19 | | -# without specific prior written permission. |
20 | | -# |
21 | | -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
22 | | -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
23 | | -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
24 | | -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
25 | | -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
26 | | -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
27 | | -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | | -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | | -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | | -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
31 | | -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | | - |
33 | | -from ietf.utils.test_utils import SimpleUrlTestCase |
34 | | - |
35 | | -class MailingListsUrlTestCase(SimpleUrlTestCase): |
36 | | - def testUrls(self): |
37 | | - self.doTestUrls(__file__) |
| 1 | +from django.core.urlresolvers import reverse as urlreverse |
| 2 | + |
| 3 | +from pyquery import PyQuery |
| 4 | + |
| 5 | +from ietf.utils.test_utils import TestCase |
| 6 | +from ietf.utils.test_data import make_test_data |
| 7 | +from ietf.utils.mail import outbox |
| 8 | + |
| 9 | + |
| 10 | +class MailingListTests(TestCase): |
| 11 | + def test_groups(self): |
| 12 | + draft = make_test_data() |
| 13 | + group = draft.group |
| 14 | + url = urlreverse("ietf.mailinglists.views.groups") |
| 15 | + |
| 16 | + # only those with an archive |
| 17 | + group.list_archive = "" |
| 18 | + group.save() |
| 19 | + r = self.client.get(url) |
| 20 | + self.assertEqual(r.status_code, 200) |
| 21 | + q = PyQuery(r.content) |
| 22 | + self.assertEqual(len(q(".group-archives a:contains(\"%s\")" % group.acronym)), 0) |
| 23 | + |
| 24 | + # successful get |
| 25 | + group.list_archive = "https://example.com/foo" |
| 26 | + group.save() |
| 27 | + r = self.client.get(url) |
| 28 | + q = PyQuery(r.content) |
| 29 | + self.assertEqual(len(q(".group-archives a:contains(\"%s\")" % group.acronym)), 1) |
| 30 | + |
38 | 31 |
|
0 commit comments