55from compiler_admin .commands .delete import delete , __name__ as MODULE
66
77
8+ @pytest .fixture
9+ def mock_input_yes (mock_input ):
10+ fix = mock_input (MODULE )
11+ fix .return_value = "y"
12+ return fix
13+
14+
15+ @pytest .fixture
16+ def mock_input_no (mock_input ):
17+ fix = mock_input (MODULE )
18+ fix .return_value = "n"
19+ return fix
20+
21+
822@pytest .fixture
923def mock_google_user_exists (mock_google_user_exists ):
1024 return mock_google_user_exists (MODULE )
@@ -22,7 +36,8 @@ def test_delete_user_username_required():
2236 delete (args )
2337
2438
25- def test_delete_user_exists (mock_google_user_exists , mock_google_CallGAMCommand ):
39+ @pytest .mark .usefixtures ("mock_input_yes" )
40+ def test_delete_confirm_yes (mock_google_user_exists , mock_google_CallGAMCommand ):
2641 mock_google_user_exists .return_value = True
2742
2843 args = Namespace (username = "username" )
@@ -36,6 +51,17 @@ def test_delete_user_exists(mock_google_user_exists, mock_google_CallGAMCommand)
3651 assert "noactionifalias" in call_args
3752
3853
54+ @pytest .mark .usefixtures ("mock_input_no" )
55+ def test_delete_confirm_no (mock_google_user_exists , mock_google_CallGAMCommand ):
56+ mock_google_user_exists .return_value = True
57+
58+ args = Namespace (username = "username" )
59+ res = delete (args )
60+
61+ assert res == RESULT_SUCCESS
62+ mock_google_CallGAMCommand .assert_not_called ()
63+
64+
3965def test_delete_user_does_not_exist (mock_google_user_exists , mock_google_CallGAMCommand ):
4066 mock_google_user_exists .return_value = False
4167
0 commit comments