Exemplo n.º 1
0
 def test_get_reads_expected_file(self, mock_open):
     store = AlertCursorStore(PROFILE_NAME)
     store.get(CURSOR_NAME)
     user_path = path.join(path.expanduser("~"), ".code42cli")
     expected_path = path.join(user_path, ALERT_CHECKPOINT_FOLDER_NAME,
                               PROFILE_NAME, CURSOR_NAME)
     mock_open.assert_called_once_with(expected_path)
Exemplo n.º 2
0
 def test_get_when_profile_does_not_exist_returns_none(self, mocker):
     store = AlertCursorStore(PROFILE_NAME)
     checkpoint = store.get(CURSOR_NAME)
     mock_open = mocker.patch(f"{_NAMESPACE}.open")
     mock_open.side_effect = FileNotFoundError
     assert checkpoint is None
Exemplo n.º 3
0
 def test_get_returns_expected_timestamp(self, mock_open):
     store = AlertCursorStore(PROFILE_NAME)
     checkpoint = store.get(CURSOR_NAME)
     assert checkpoint == 123456789