forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
45 lines (33 loc) · 1.42 KB
/
tests.py
File metadata and controls
45 lines (33 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright The IETF Trust 2009-2020, All Rights Reserved
# -*- coding: utf-8 -*-
from pyquery import PyQuery
from django.urls import reverse as urlreverse
import debug # pyflakes:ignore
from ietf.group.factories import GroupFactory
from ietf.mailinglists.factories import ListFactory
from ietf.utils.test_utils import TestCase
class MailingListTests(TestCase):
def test_groups(self):
url = urlreverse("ietf.mailinglists.views.groups")
# only those with an archive
group = GroupFactory()
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEqual(len(q("#content a:contains(\"%s\")" % group.acronym)), 0)
# successful get
group = GroupFactory(list_archive = "https://example.com/foo")
r = self.client.get(url)
q = PyQuery(r.content)
self.assertEqual(len(q("#content a:contains(\"%s\")" % group.acronym)), 1)
def test_nonwg(self):
lists = ListFactory.create_batch(7)
url = urlreverse("ietf.mailinglists.views.nonwg")
r = self.client.get(url)
for l in lists:
if l.advertised:
self.assertContains(r, l.name)
self.assertContains(r, l.description)
else:
self.assertNotContains(r, l.name, html=True)
self.assertNotContains(r, l.description, html=True)