x2gobroker.nameservices.testsuite_nameservice module¶
- class x2gobroker.nameservices.testsuite_nameservice.X2GoBrokerNameService[source]¶
Bases:
x2gobroker.nameservices.base_nameservice.X2GoBrokerNameService
- get_group_members(group, primary_groups=False)[source]¶
Retrieve a list of users being members of a given group. For unit testing, the group membership relations have been hard-coded.
Optionally, primary group memberships can be considered (or not).
- Parameters
group (
str
) – name of the group to retrieve members ofprimary_groups (
bool
) – take primary group membership into consideration or not
- Returns
list of users that are members of the given group
- Return type
list
- get_groups()[source]¶
Retrieve hard-coded list of groups that we can use for unit testing.
- Returns
list of known group names
- Return type
list
- get_primary_group(username)[source]¶
In POSIX, the primary group name is equal to the user name. As this is the only straw we can grab during unit tests, we return the username here.
- Parameters
username (
str
) – name of the user to get the primary group for- Returns
name of the primary group of the given user
- Return type
str