def test_fetch_list_of_models_mapped_fields(read_database: ReadDatabase, connection: ConnectionHandler): args = [MagicMock(), MagicMock(), MagicMock()] row = MagicMock() row.copy = lambda: row connection.query = q = MagicMock(return_value=[row]) models = read_database.fetch_list_of_models(*args, [1]) q.assert_called_with(*args) assert models == [row]
def test_fetch_list_of_models(read_database: ReadDatabase, connection: ConnectionHandler): args = [MagicMock(), MagicMock(), MagicMock()] row = MagicMock() row["data"] = MagicMock() connection.query = q = MagicMock(return_value=[row]) models = read_database.fetch_list_of_models(*args, []) q.assert_called_with(*args) assert models == [row["data"]]