MCPcopy Create free account
hub / github.com/saltstack/salt / test_token

Function test_token

tests/pytests/integration/wheel/test_client.py:33–59  ·  view source on GitHub ↗

Test executing master_call with lowdata The choice of using key.list_all for this is arbitrary and should be changed to some mocked function that is more testing friendly.

(client, client_config, auth_creds, salt_auto_account)

Source from the content-addressed store, hash-verified

31
32
33def test_token(client, client_config, auth_creds, salt_auto_account):
34 """
35 Test executing master_call with lowdata
36
37 The choice of using key.list_all for this is arbitrary and should be
38 changed to some mocked function that is more testing friendly.
39 """
40 auth = salt.auth.LoadAuth(client_config)
41 token = auth.mk_token(auth_creds)
42
43 ret = client.master_call(
44 **{
45 "client": "wheel",
46 "fun": "key.list_all",
47 "token": token["token"],
48 "print_event": False,
49 }
50 )
51 assert ret
52 assert "data" in ret
53 data = ret["data"]
54 assert data["success"] is True
55 assert data["user"] == salt_auto_account.username
56 assert data["fun"] == "wheel.key.list_all"
57 assert data["return"]
58 master_id = client.opts["id"].removesuffix("_master")
59 assert data["return"]["local"] == [f"{master_id}.pem", f"{master_id}.pub"]
60
61
62def test_cmd_sync(client, auth_creds, salt_auto_account):

Callers

nothing calls this directly

Calls 2

mk_tokenMethod · 0.95
master_callMethod · 0.45

Tested by

no test coverage detected