From 78ed9334d2537962a209d10eda9589f26d96cae2 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 11 Jun 2016 23:40:20 +0000 Subject: [PATCH] Skip the htpasswd update test which uses an external binary if the binary isn't found Fixes the failing OS X test. - Legacy-Id: 11323 --- ietf/ietfauth/tests.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ietf/ietfauth/tests.py b/ietf/ietfauth/tests.py index 8e301f5dc..3d7722b0c 100644 --- a/ietf/ietfauth/tests.py +++ b/ietf/ietfauth/tests.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import os, shutil from urlparse import urlsplit - from pyquery import PyQuery +from unittest import skipIf from django.core.urlresolvers import reverse as urlreverse import django.contrib.auth.views @@ -17,6 +17,14 @@ from ietf.group.models import Group, Role, RoleName from ietf.ietfauth.htpasswd import update_htpasswd_file import ietf.ietfauth.views +if os.path.exists(settings.HTPASSWD_COMMAND): + skip_htpasswd_command = False + skip_message = "" +else: + skip_htpasswd_command = True + skip_message = ("The binary for htpasswd wasn't found " + "in the locations indicated in settings.py.") + class IetfAuthTests(TestCase): def setUp(self): self.saved_use_python_htdigest = getattr(settings, "USE_PYTHON_HTDIGEST", None) @@ -279,6 +287,7 @@ class IetfAuthTests(TestCase): update_htpasswd_file("foo", "passwd") self.assertTrue(self.username_in_htpasswd_file("foo")) + @skipIf(skip_htpasswd_command, skip_message) def test_htpasswd_file_with_htpasswd_binary(self): # make sure we test both Python and call-out to binary settings.USE_PYTHON_HTDIGEST = False