Re: [F16 PATCH 1/2] Update test for createUser and createGroup (#739428)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks fine, but I still don't like how we pass the parameters to these
functions. Why do we need to pass GROUP separately when it is already in
the dict, that is passed there too? What if these parameters are
different? I bet that only one gets used and the other is ignored, and
that's not very elegant imho.

On Mon, 2011-09-19 at 12:08 -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl@xxxxxxxxxx>
> 
> ---
>  tests/pyanaconda_test/users_test.py |   19 ++++++++++++++++---
>  1 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/pyanaconda_test/users_test.py b/tests/pyanaconda_test/users_test.py
> index e34bb9e..c7246ea 100644
> --- a/tests/pyanaconda_test/users_test.py
> +++ b/tests/pyanaconda_test/users_test.py
> @@ -41,9 +41,13 @@ class UsersTest(mock.TestCase):
>  
>          GROUP = 'Group'
>          GID = 100
> +        group_dict = {  "name" : GROUP,
> +                        "gid" : GID,
> +                        "root" : ""
> +                    }
>  
>          usr = pyanaconda.users.Users(self.anaconda)
> -        self.assertTrue(usr.createGroup(GROUP, gid=GID, root=''))
> +        self.assertTrue(usr.createGroup(GROUP, **group_dict))
>  
>          methods = pyanaconda.users.libuser.admin().method_calls[:]
>          try:
> @@ -64,13 +68,22 @@ class UsersTest(mock.TestCase):
>  
>          USER = 'TestUser'
>          PASS = 'abcde'
> +        user_dict = {   "name" : USER,
> +                        "password" : PASS,
> +                        "groups" : [],
> +                        "homedir" : "",
> +                        "isCrypted" : False,
> +                        "shell" : "",
> +                        "uid" : None,
> +                        "root" : ""
> +                    }
>  
>          usr = pyanaconda.users.Users(self.anaconda)
> -        self.assertTrue(usr.createUser(USER, password=PASS, root=''))
> +        self.assertTrue(usr.createUser(USER, **user_dict))
>  
>          self.assertTrue(pyanaconda.users.iutil.mkdirChain.called)
> -
>          methods = [x[0] for x in pyanaconda.users.libuser.admin().method_calls]
> +
>          self.assertEqual(methods,
>              ['lookupUserByName', 'initUser', 'initGroup', 'addUser','addGroup',
>               'setpassUser', 'lookupGroupByName'])

-- 
Martin Gracik <mgracik@xxxxxxxxxx>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux