Skip to content

Commit f75728c

Browse files
committedFeb 5, 2024·
add --keep-sssd flag
1 parent be03b08 commit f75728c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed
 

‎conftest.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
tokens = None
1616

1717

18-
def load_tokens(user, token_list):
18+
def load_tokens(user, token_list, update_sssd):
1919
log.info("Loading tokens")
2020
for index, token in enumerate(token_list):
21-
log.debug("Loading %s. token", index)
22-
setattr(user, f"card_{index}", load_token(token, update_sssd = True))
23-
log.debug(f"Token %s is loaded", index)
21+
log.debug("Loading %s. token", index)
22+
setattr(
23+
user, f"card_{index}", load_token(token, update_sssd = update_sssd)
24+
)
25+
log.debug(f"Token %s is loaded", index)
2426

2527

2628
def update_ca(user, token_list):
@@ -56,7 +58,7 @@ def pytest_configure(config):
5658
ipa_server=ipa_server)
5759
assert ipa_user.user_type == "ipa"
5860
log.debug("IPA user is loaded")
59-
load_tokens(ipa_user, tokens)
61+
load_tokens(ipa_user, tokens, config.getoption("keep_sssd"))
6062
ipa_user.card = ipa_user.card_0
6163
ipa_user.pin = ipa_user.card.pin
6264
if user_type in ["local", "all"]:
@@ -65,7 +67,7 @@ def pytest_configure(config):
6567
"local_username"))
6668
assert local_user.user_type == "local"
6769
log.debug("Local user is loaded")
68-
load_tokens(local_user, tokens)
70+
load_tokens(local_user, tokens, config.getoption("keep_sssd"))
6971
# backwards compatibility fix. Older tests expected one virtual card
7072
# as attribute of user - i.e. user.card and approached card this way.
7173
# As of now we expect user can have multiple cards, they are marked
@@ -113,6 +115,12 @@ def pytest_addoption(parser):
113115
dest="tokens",
114116
help="List of tokens to be prepared"
115117
)
118+
parser.addoption(
119+
"--keep-sssd",
120+
action="store_false",
121+
dest="keep_sssd",
122+
help="Prevents the forced change of sssd.conf"
123+
)
116124

117125

118126
def pytest_generate_tests(metafunc):

0 commit comments

Comments
 (0)
Please sign in to comment.