def test_raises_on_invalid_json(self, mocked_get_file): """Test raises an error when the file contains invalid JSON.""" invalid_json = "None" path_mock = mock.Mock() path_mock.read_text.return_value = invalid_json mocked_get_file.return_value = path_mock with pytest.raises(board_database.ResponseJSONError): board_database.get_offline_board_data()
def from_offline_database(cls) -> "Boards": """Initialise with the offline board database. Raises: BoardDatabaseError: Could not retrieve data from the board database. """ return cls( Board.from_offline_board_entry(b) for b in board_database.get_offline_board_data())
def test_local_target_database_file_found(self): """Test local database is found and loaded.""" data = board_database.get_offline_board_data() assert len(data), "Some data should be returned from local database file."