URL: https://github.com/freeipa/freeipa/pull/181
Author: gkaihorodova
 Title: #181: Tests : User Tracker creation of user with minimal values
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/181/head:pr181
git checkout pr181
From 66376aa06260cde40e8674941be964465d4878d5 Mon Sep 17 00:00:00 2001
From: Ganna Kaihorodova <gkaih...@redhat.com>
Date: Mon, 24 Oct 2016 11:27:01 +0200
Subject: [PATCH] User Tracker: creation of user with minimal values

Fix provide possibility to create user-add test with minimal values,
where uid is not specified, to provide better coverage

https://fedorahosted.org/freeipa/ticket/6126
---
 ipatests/test_xmlrpc/tracker/user_plugin.py | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/ipatests/test_xmlrpc/tracker/user_plugin.py b/ipatests/test_xmlrpc/tracker/user_plugin.py
index 4485fd9..a55fb29 100644
--- a/ipatests/test_xmlrpc/tracker/user_plugin.py
+++ b/ipatests/test_xmlrpc/tracker/user_plugin.py
@@ -62,7 +62,7 @@ class UserTracker(KerberosAliasMixin, Tracker):
 
     primary_keys = {u'uid', u'dn'}
 
-    def __init__(self, name, givenname, sn, **kwargs):
+    def __init__(self, name=None, givenname=None, sn=None, **kwargs):
         super(UserTracker, self).__init__(default_version=None)
         self.uid = name
         self.givenname = givenname
@@ -71,13 +71,20 @@ def __init__(self, name, givenname, sn, **kwargs):
 
         self.kwargs = kwargs
 
-    def make_create_command(self):
-        """ Make function that crates a user using user-add """
-        return self.make_command(
-            'user_add', self.uid,
-            givenname=self.givenname,
-            sn=self.sn, **self.kwargs
-            )
+    def make_create_command(self, force=None):
+        """ Make function that creates a user using user-add """
+
+        if self.uid is not None:
+            return self.make_command(
+                'user_add', self.uid,
+                givenname=self.givenname,
+                sn=self.sn, **self.kwargs
+                )
+        else:
+            return self.make_command(
+                'user_add', givenname=self.givenname,
+                sn=self.sn, **self.kwargs
+                )
 
     def make_delete_command(self, no_preserve=True, preserve=False):
         """ Make function that deletes a user using user-del """
-- 
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