remove prefix

This commit is contained in:
2025-05-22 16:54:43 -03:00
parent a51723f64f
commit 585bcfcc2a
5 changed files with 38 additions and 24 deletions

View File

@@ -111,9 +111,8 @@ def test_transact_write_items(
exc_cls=EmailConflictError,
)
with pytest.raises(EmailConflictError) as exc:
with pytest.raises(EmailConflictError):
dynamodb_persistence_layer.transact_write_items(transact)
# print(exc.value)
def test_collection_get_item(
@@ -257,8 +256,8 @@ def test_collection_get_items(
doc = collect.get_items(
TransactKey('cJtK9SsnJhKPyxESe7g3DG')
+ SortKey('0')
+ SortKey('billing_policy', path_spec='payment_method')
+ SortKey('payment_policy'),
+ SortKey('metadata#billing_policy', path_spec='payment_method')
+ SortKey('metadata#payment_policy', remove_prefix='metadata#'),
)
assert doc == {
@@ -267,7 +266,7 @@ def test_collection_get_items(
'id': 'cJtK9SsnJhKPyxESe7g3DG',
'cnpj': '15608435000190',
'email': 'org+15608435000190@users.noreply.betaeducacao.com.br',
'billing_policy': 'PIX',
'metadata#billing_policy': 'PIX',
'payment_policy': {'due_days': Decimal('90')},
}
@@ -280,12 +279,15 @@ def test_collection_get_items_unflatten(
doc = collect.get_items(
TransactKey('cJtK9SsnJhKPyxESe7g3DG')
+ SortKey('billing_policy')
+ SortKey('payment_policy'),
+ SortKey('metadata#billing_policy')
+ SortKey('metadata#payment_policy', remove_prefix='metadata#'),
flatten_top=False,
)
assert doc == {
'billing_policy': {'billing_day': Decimal('1'), 'payment_method': 'PIX'},
'metadata#billing_policy': {
'billing_day': Decimal('1'),
'payment_method': 'PIX',
},
'payment_policy': {'due_days': Decimal('90')},
}