Skip to content

Commit 59e3dbd

Browse files
Add unit test.
1 parent 735a7bd commit 59e3dbd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/unit/server_tests/test_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ def test_no_state_ini_file_or_state_dir(
6868
TabPyApp(None)
6969
self.assertEqual(len(mock_os.makedirs.mock_calls), 1)
7070

71+
@patch('builtins.input', return_value='y')
72+
@patch("tabpy.tabpy_server.app.app.os")
73+
@patch("tabpy.tabpy_server.app.app.os.path.exists", return_value=False)
74+
@patch("tabpy.tabpy_server.app.app.PythonServiceHandler")
75+
@patch("tabpy.tabpy_server.app.app._get_state_from_file")
76+
@patch("tabpy.tabpy_server.app.app.TabPyState")
77+
def test_handle_configuration_without_authentication(
78+
self,
79+
mock_tabpy_state,
80+
mock_get_state_from_file,
81+
mock_psws,
82+
mock_os_path_exists,
83+
mock_os,
84+
mock_input,
85+
):
86+
TabPyApp(None)
87+
mock_input.assert_not_called()
88+
89+
TabPyApp(None, False)
90+
mock_input.assert_called()
7191

7292
class TestPartialConfigFile(unittest.TestCase):
7393
def setUp(self):

0 commit comments

Comments
 (0)