mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add group support to the create_account
pytest helper
This commit is contained in:
parent
022412ebb3
commit
e4c8839cd2
1 changed files with 7 additions and 1 deletions
|
@ -253,7 +253,7 @@ class TestAccount:
|
|||
hashed_password = attr.ib(repr=False)
|
||||
create_group = attr.ib(repr=False, default=False)
|
||||
group_name = attr.ib()
|
||||
_group = attr.ib(init=False, repr=False)
|
||||
_group = attr.ib(init=True, repr=False)
|
||||
_delete_account = attr.ib(init=False, repr=False, default=False)
|
||||
|
||||
@sminion.default
|
||||
|
@ -299,6 +299,10 @@ class TestAccount:
|
|||
)
|
||||
return self._group
|
||||
|
||||
@group.setter
|
||||
def _set_group(self, value):
|
||||
self._group = value
|
||||
|
||||
def __enter__(self):
|
||||
if not self.sminion.functions.user.info(self.username):
|
||||
log.debug("Creating system account: %s", self)
|
||||
|
@ -381,6 +385,7 @@ def create_account(
|
|||
hashed_password=attr.NOTHING,
|
||||
group_name=attr.NOTHING,
|
||||
create_group=False,
|
||||
group=attr.NOTHING,
|
||||
sminion=attr.NOTHING,
|
||||
):
|
||||
with TestAccount(
|
||||
|
@ -390,6 +395,7 @@ def create_account(
|
|||
hashed_password=hashed_password,
|
||||
group_name=group_name,
|
||||
create_group=create_group,
|
||||
group=group,
|
||||
) as account:
|
||||
yield account
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue