def test_create_or_update_models(read_database: ReadDatabase, connection: ConnectionHandler): fqid1 = MagicMock() model1 = MagicMock() fqid2 = MagicMock() model2 = MagicMock() models = {fqid1: model1, fqid2: model2} connection.execute = e = MagicMock() read_database.json = lambda x: x read_database.create_or_update_models(models) args = e.call_args.args[1] assert (args == [fqid1, model1, fqid2, model2 ]) or (args == [fqid2, model2, fqid1, model1])
def test_create_or_update_models_no_models(read_database: ReadDatabase, connection: ConnectionHandler): connection.execute = e = MagicMock() read_database.create_or_update_models([]) e.assert_not_called()