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 5980a35e6c
This commit is contained in:
Henrik Levkowetz 2015-03-22 16:57:14 +00:00
commit 7b94d6086a
2 changed files with 50 additions and 4 deletions

View file

@ -1,10 +1,28 @@
import os
from unittest import skipIf
from django.conf import settings
from django.core.urlresolvers import reverse as urlreverse
from django.db.models import Q
from django.test import Client
from ietf.group.models import Role
from ietf.group.models import Role, Group
from ietf.utils.test_data import make_test_data
from ietf.utils.test_utils import login_testing_unauthorized, TestCase
if getattr(settings,'SKIP_DOT_TO_PDF', False):
skip_dot_to_pdf = True
skip_message = "settings.SKIP_DOT_TO_PDF = %s" % skip_dot_to_pdf
elif ( os.path.exists(settings.DOT_BINARY) and
os.path.exists(settings.UNFLATTEN_BINARY) and
os.path.exists(settings.PS2PDF_BINARY)):
skip_dot_to_pdf = False
skip_message = ""
else:
skip_dot_to_pdf = True
skip_message = ("One or more of the binaries for dot, unflatten and ps2pdf weren't found "
"in the locations indicated in settings.py.")
class StreamTests(TestCase):
def test_streams(self):
make_test_data()
@ -36,3 +54,30 @@ class StreamTests(TestCase):
r = self.client.post(url, dict(delegates="ad2@ietf.org"))
self.assertEqual(r.status_code, 302)
self.assertTrue(Role.objects.filter(name="delegate", group__acronym=stream_acronym, email__address="ad2@ietf.org"))
@skipIf(skip_dot_to_pdf, skip_message)
class GroupTests(TestCase):
def test_group_document_dependency_dotfile(self):
make_test_data()
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
client = Client(Accept='application/pdf')
r = client.get(urlreverse("ietf.group.info.dependencies_dot",
kwargs=dict(acronym=group.acronym)))
self.assertTrue(r.status_code == 200, "Failed to receive "
"a dot dependency graph for group: %s"%group.acronym)
self.assertGreater(len(r.content), 0, "Dot dependency graph for group "
"%s has no content"%group.acronym)
def test_group_document_dependency_pdffile(self):
make_test_data()
for group in Group.objects.filter(Q(type="wg") | Q(type="rg")):
client = Client(Accept='application/pdf')
r = client.get(urlreverse("ietf.group.info.dependencies_pdf",
kwargs=dict(acronym=group.acronym)))
self.assertTrue(r.status_code == 200, "Failed to receive "
"a pdf dependency graph for group: %s"%group.acronym)
self.assertGreater(len(r.content), 0, "Pdf dependency graph for group "
"%s has no content"%group.acronym)

View file

@ -1,12 +1,13 @@
# By saying 'Ready for merge' in the commit message when you commit a change
# to your branch, the commit will be included in the merge list for the next
# release. However, if a commit for some reason haven't is missing that
# By saying 'Commit ready for merge' in the commit message when you commit a
# change to your branch, the commit will be included in the merge list for the
# next release. However, if a commit for some reason haven't is missing that
# phrase in the commit comment, the branch and revision of the changeset can
# be added to this file in trunk/ by the merge master, and it will also be
# included in the merge list.
# --- Add entries at the top ---
personal/willem/v5.12.4.dev0@9316
branch/iola/facelift-r8876@8970 Test crawler speed-up
branch/iola/facelift-r8510@8733
personal/rcross/v5.7.3-dev0@8641