add flatten top

This commit is contained in:
2025-04-08 17:33:50 -03:00
parent 6450e5fa7c
commit 5b5e381191
3 changed files with 42 additions and 15 deletions

View File

@@ -246,12 +246,11 @@ def test_collection_get_items(
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
):
collect = DynamoDBCollection(dynamodb_persistence_layer)
doc = collect.get_items(
TransactKey('cJtK9SsnJhKPyxESe7g3DG')
+ SortKey('0')
+ SortKey('billing_policy')
+ SortKey('payment_policy')
+ SortKey('payment_policy'),
)
assert doc == {
@@ -263,3 +262,22 @@ def test_collection_get_items(
'billing_policy': {'billing_day': Decimal('1'), 'payment_method': 'PIX'},
'payment_policy': {'due_days': Decimal('90')},
}
def test_collection_get_items_unflatten(
dynamodb_seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
):
collect = DynamoDBCollection(dynamodb_persistence_layer)
doc = collect.get_items(
TransactKey('cJtK9SsnJhKPyxESe7g3DG')
+ SortKey('billing_policy')
+ SortKey('payment_policy'),
flatten_top=False,
)
assert doc == {
'billing_policy': {'billing_day': Decimal('1'), 'payment_method': 'PIX'},
'payment_policy': {'due_days': Decimal('90')},
}