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