URL: https://github.com/freeipa/freeipa/pull/465
Author: MartinBasti
 Title: #465: Tests: search for disabled users
Action: opened

PR body:
"""
Add tests for searching disabled/enabled users.
   
XFAIL: newly created users has no 'nsaccountlock' attribute set and
user-find doesn't return them as active users. This should be fixed.

Partially tests: #444 

"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/465/head:pr465
git checkout pr465
From 54526f42356a65993341f68aaea36e287b364c6b Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Tue, 14 Feb 2017 19:06:23 +0100
Subject: [PATCH] Tests: search for disabled users

Add tests for searching disabled/enabled users.

XFAIL: newly created users has no 'nsaccountlock' attribute set and
user-find doesn't return them as active users. This should be fixed.
---
 ipatests/test_xmlrpc/test_user_plugin.py | 41 ++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/ipatests/test_xmlrpc/test_user_plugin.py b/ipatests/test_xmlrpc/test_user_plugin.py
index d33c4d7..098163d 100644
--- a/ipatests/test_xmlrpc/test_user_plugin.py
+++ b/ipatests/test_xmlrpc/test_user_plugin.py
@@ -240,6 +240,47 @@ def test_find_with_pkey_only(self, user):
         result = command()
         user.check_find(result, pkey_only=True)
 
+    @pytest.mark.xfail(
+        reason="new users don't have set attribute nsaccountlock in LDAP, "
+               "thus this search doesn't return it in result")
+    def test_find_enabled_user(self, user):
+        """Test user-find --disabled=False with enabled user"""
+        user.ensure_exists()
+        command = user.make_find_command(
+            uid=user.uid, pkey_only=True, nsaccountlock=False)
+        result = command()
+        user.check_find(result, pkey_only=True)
+
+    def test_negative_find_enabled_user(self, user):
+        """Test user-find --disabled=True with enabled user, shouldn't
+        return any result"""
+        user.ensure_exists()
+        command = user.make_find_command(
+            uid=user.uid, pkey_only=True, nsaccountlock=True)
+        result = command()
+        user.check_find_nomatch(result)
+
+    def test_find_disabled_user(self, user):
+        """Test user-find --disabled=True with disabled user"""
+        user.ensure_exists()
+        user.disable()
+        command = user.make_find_command(
+            uid=user.uid, pkey_only=True, nsaccountlock=True)
+        result = command()
+        user.check_find(result, pkey_only=True)
+        user.enable()
+
+    def test_negative_find_disabled_user(self, user):
+        """Test user-find --disabled=False with disabled user, shouldn't
+        return any results"""
+        user.ensure_exists()
+        user.disable()
+        command = user.make_find_command(
+            uid=user.uid, pkey_only=True, nsaccountlock=False)
+        result = command()
+        user.check_find_nomatch(result)
+        user.enable()
+
 
 @pytest.mark.tier1
 class TestActive(XMLRPC_test):
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to