Skip to content

Commit

Permalink
updated hash key and range key fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishmeet Bindra committed Jan 8, 2024
1 parent fe6d9b2 commit 923059e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/test_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ def complex_query_data(complex_table):
yield data
finally:
for datum in data:
ComplexKeyModel.delete((datum[ComplexKeyModel.Config.hash_key], datum[ComplexKeyModel.Config.range_key]))
ComplexKeyModel.delete((datum[ComplexKeyModel.model_config.get("hash_key")], datum[ComplexKeyModel.model_config.get("range_key")]))


@pytest.fixture(scope="module")
def alias_query_data(alias_table):
presets = [dict(name="Jerry"), dict(name="Hermione"), dict(), dict(), dict()]
data = [datum for datum in [alias_model_data_generator(**i) for i in presets]]
for datum in data:
AliasKeyModel.parse_obj(datum).save()
AliasKeyModel.model_validate(datum).save()
try:
yield data
finally:
Expand Down Expand Up @@ -505,7 +505,7 @@ def test_query_alias_save(dynamo):
AliasKeyModel.initialize()
try:
for datum in data:
AliasKeyModel.parse_obj(datum).save()
AliasKeyModel.model_validate(datum).save()
except Exception as e:
raise pytest.fail("Failed to save Alias model!")

Expand Down
8 changes: 4 additions & 4 deletions tests/test_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def test_query(model_in_db):
data2["id"] = 2
data3 = model_data_generator()
data3["id"] = 1234
Model.parse_obj(data1).save()
Model.parse_obj(data2).save()
Model.parse_obj(data3).save()
Model.model_validate(data1).save()
Model.model_validate(data2).save()
Model.model_validate(data3).save()
for r in range(0, 10):
_data = model_data_generator()
_data["id"] += 3
Model.parse_obj(_data).save()
Model.model_validate(_data).save()
res = Model.query(Rule(f"id < 3"))
data = {m.id: m.dict() for m in res}
assert data == {1: data1, 2: data2}

0 comments on commit 923059e

Please sign in to comment.