@@ -26,31 +26,33 @@ def sample_config(custom_config_file: Path) -> dict:
26
26
27
27
def test_switch_env (mock_commands_config ):
28
28
assert Config ().active_env_name == "e1"
29
- res = switch (switch_type = "env" , switch_arg = "e2" )
29
+ assert Config ().active_participant_id == "p1"
30
+ res = switch (env = "e2" )
30
31
31
32
assert res == RESULT_SUCCESS
32
33
mock_commands_config .assert_called_once_with ()
33
- assert Config ().active_env_name != "e1"
34
34
assert Config ().active_env_name == "e2"
35
+ assert Config ().active_participant_id == "p1"
35
36
36
37
37
38
def test_switch_participant (mock_commands_config ):
39
+ assert Config ().active_env_name == "e1"
38
40
assert Config ().active_participant_id == "p1"
39
- res = switch (switch_type = " participant" , switch_arg = "p2" )
41
+ res = switch (participant = "p2" )
40
42
41
43
assert res == RESULT_SUCCESS
42
44
mock_commands_config .assert_called_once_with ()
43
- assert Config ().active_participant_id != "p1 "
45
+ assert Config ().active_env_name == "e1 "
44
46
assert Config ().active_participant_id == "p2"
45
47
46
48
47
- def test_switch_unrecognized_type (mock_commands_config ):
48
- env = Config ().active_env_name
49
- participant = Config ().active_participant_id
49
+ def test_switch_both (mock_commands_config ):
50
+ assert Config ().active_env_name == "e1"
51
+ assert Config ().active_participant_id == "p1"
50
52
51
- with pytest .raises (ValueError ):
52
- switch (switch_type = "unrecognized" , switch_arg = "new_value" )
53
+ res = switch (env = "e2" , participant = "p2" )
53
54
54
- assert Config ().active_env_name == env
55
- assert Config ().active_participant_id == participant
56
- assert mock_commands_config .call_count == 0
55
+ assert res == RESULT_SUCCESS
56
+ mock_commands_config .assert_called_once_with ()
57
+ assert Config ().active_env_name == "e2"
58
+ assert Config ().active_participant_id == "p2"
0 commit comments