Skip to content

Commit 7b94d60

Browse files
committed
Merged in [9316] from willem@nlnetlabs.nl:
Test fetching of wg and rg document dependency graphs. Also added conditional running of these tests, as they depend on the availability of the dot, unflatten and ps2pdf binaries, which may not be available on all developers' systems. - Legacy-Id: 9322 Note: SVN reference [9316] has been migrated to Git commit 5980a35
2 parents 286ca37 + 5980a35 commit 7b94d60

2 files changed

Lines changed: 50 additions & 4 deletions

File tree

ietf/group/tests.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
import os
2+
from unittest import skipIf
13

4+
from django.conf import settings
25
from django.core.urlresolvers import reverse as urlreverse
6+
from django.db.models import Q
7+
from django.test import Client
38

4-
from ietf.group.models import Role
9+
from ietf.group.models import Role, Group
510
from ietf.utils.test_data import make_test_data
611
from ietf.utils.test_utils import login_testing_unauthorized, TestCase
712

13+
if getattr(settings,'SKIP_DOT_TO_PDF', False):
14+
skip_dot_to_pdf = True
15+
skip_message = "settings.SKIP_DOT_TO_PDF = %s" % skip_dot_to_pdf
16+
elif ( os.path.exists(settings.DOT_BINARY) and
17+
os.path.exists(settings.UNFLATTEN_BINARY) and
18+
os.path.exists(settings.PS2PDF_BINARY)):
19+
skip_dot_to_pdf = False
20+
skip_message = ""
21+
else:
22+
skip_dot_to_pdf = True
23+
skip_message = ("One or more of the binaries for dot, unflatten and ps2pdf weren't found "
24+
"in the locations indicated in settings.py.")
25+
826
class StreamTests(TestCase):
927
def test_streams(self):
1028
make_test_data()
@@ -36,3 +54,30 @@ def test_stream_edit(self):
3654
r = self.client.post(url, dict(delegates="ad2@ietf.org"))
3755
self.assertEqual(r.status_code, 302)
3856
self.assertTrue(Role.objects.filter(name="delegate", group__acronym=stream_acronym, email__address="ad2@ietf.org"))
57+
58+
59+
@skipIf(skip_dot_to_pdf, skip_message)
60+
class GroupTests(TestCase):
61+
62+
def test_group_document_dependency_dotfile(self):
63+
make_test_data()
64+
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
65+
client = Client(Accept='application/pdf')
66+
r = client.get(urlreverse("ietf.group.info.dependencies_dot",
67+
kwargs=dict(acronym=group.acronym)))
68+
self.assertTrue(r.status_code == 200, "Failed to receive "
69+
"a dot dependency graph for group: %s"%group.acronym)
70+
self.assertGreater(len(r.content), 0, "Dot dependency graph for group "
71+
"%s has no content"%group.acronym)
72+
73+
def test_group_document_dependency_pdffile(self):
74+
make_test_data()
75+
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
76+
client = Client(Accept='application/pdf')
77+
r = client.get(urlreverse("ietf.group.info.dependencies_pdf",
78+
kwargs=dict(acronym=group.acronym)))
79+
self.assertTrue(r.status_code == 200, "Failed to receive "
80+
"a pdf dependency graph for group: %s"%group.acronym)
81+
self.assertGreater(len(r.content), 0, "Pdf dependency graph for group "
82+
"%s has no content"%group.acronym)
83+

ready-for-merge

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# By saying 'Ready for merge' in the commit message when you commit a change
2-
# to your branch, the commit will be included in the merge list for the next
3-
# release. However, if a commit for some reason haven't is missing that
1+
# By saying 'Commit ready for merge' in the commit message when you commit a
2+
# change to your branch, the commit will be included in the merge list for the
3+
# next release. However, if a commit for some reason haven't is missing that
44
# phrase in the commit comment, the branch and revision of the changeset can
55
# be added to this file in trunk/ by the merge master, and it will also be
66
# included in the merge list.
77

88
# --- Add entries at the top ---
99

10+
personal/willem/v5.12.4.dev0@9316
1011
branch/iola/facelift-r8876@8970 Test crawler speed-up
1112
branch/iola/facelift-r8510@8733
1213
personal/rcross/v5.7.3-dev0@8641

0 commit comments

Comments
 (0)