def test_database_update_by_id(tmpdir): file = tmpdir.join("test.db.json") file.write(UUID_FIXTURE_STR) db = Database().on(file.strpath) db.updateById(UUID_FIXTURE["data"][0]["id"], {"name": "test works!"}) x = db.get()[0]["name"] assert db.get()[0]["name"] == "test works!"
def test_database_update_by_id_not_found(tmpdir): file = tmpdir.join("test.db.json") file.write(UUID_FIXTURE_STR) db = Database().on(file.strpath) with pytest.raises(IdNotFoundError): db.updateById(123, {"name": "not found :("})