diff --git a/tests/unittests/general/webfront_test.py b/tests/unittests/general/webfront_test.py index 325a87842e..58e085aec3 100644 --- a/tests/unittests/general/webfront_test.py +++ b/tests/unittests/general/webfront_test.py @@ -170,6 +170,9 @@ def test_remote_user_set(self, fake_session): ) +@pytest.mark.skipif( + not nav.web.auth.ldap.available, reason="ldap module is not available" +) class TestLdapUser(object): @patch.dict( "nav.web.auth.ldap._config._sections", @@ -269,6 +272,9 @@ def fake_search(base, scope, filtr): }, }, ) +@pytest.mark.skipif( + not nav.web.auth.ldap.available, reason="ldap module is not available" +) class TestLdapEntitlements(object): def test_required_entitlement_should_be_verified(self, user_zaphod): u = nav.web.auth.ldap.LDAPUser("zaphod", user_zaphod) diff --git a/tests/unittests/web/ldapauth_test.py b/tests/unittests/web/ldapauth_test.py index 2655f1166d..6833ee086a 100644 --- a/tests/unittests/web/ldapauth_test.py +++ b/tests/unittests/web/ldapauth_test.py @@ -1,7 +1,14 @@ +import pytest + from nav.config import NAVConfigParser from nav.web.auth.ldap import LDAPUser, open_ldap from mock import Mock, patch +try: + import ldap +except ImportError: + pytestmark = pytest.mark.skip(reason="ldap module is not available") + class LdapTestConfig(NAVConfigParser): DEFAULT_CONFIG_FILES = []