update
This commit is contained in:
@@ -12,7 +12,6 @@ from layercake.dynamodb import (
|
||||
PartitionKey,
|
||||
PrefixKey,
|
||||
SortKey,
|
||||
TransactItems,
|
||||
TransactKey,
|
||||
serialize,
|
||||
)
|
||||
@@ -94,24 +93,25 @@ def test_transact_write_items(
|
||||
):
|
||||
class EmailConflictError(Exception): ...
|
||||
|
||||
transact = TransactItems(dynamodb_persistence_layer.table_name)
|
||||
transact.put(item=KeyPair('5OxmMjL-ujoR5IMGegQz', '0'))
|
||||
transact.put(item=KeyPair('cpf', '07879819908'))
|
||||
transact.put(
|
||||
item=KeyPair('email', 'sergio@somosbeta.com.br'),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
)
|
||||
transact.put(
|
||||
item=KeyPair(
|
||||
'5OxmMjL-ujoR5IMGegQz',
|
||||
ComposeKey('sergio@somosbeta.com.br', 'emails'),
|
||||
),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
exc_cls=EmailConflictError,
|
||||
)
|
||||
with dynamodb_persistence_layer.transact_items() as transact:
|
||||
# transact = TransactItems(dynamodb_persistence_layer.table_name)
|
||||
transact.put(item=KeyPair('5OxmMjL-ujoR5IMGegQz', '0'))
|
||||
transact.put(item=KeyPair('cpf', '07879819908'))
|
||||
transact.put(
|
||||
item=KeyPair('email', 'sergio@somosbeta.com.br'),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
)
|
||||
transact.put(
|
||||
item=KeyPair(
|
||||
'5OxmMjL-ujoR5IMGegQz',
|
||||
ComposeKey('sergio@somosbeta.com.br', 'emails'),
|
||||
),
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
exc_cls=EmailConflictError,
|
||||
)
|
||||
|
||||
with pytest.raises(EmailConflictError):
|
||||
dynamodb_persistence_layer.transact_write_items(transact)
|
||||
with pytest.raises(EmailConflictError):
|
||||
transact.write_items()
|
||||
|
||||
|
||||
def test_collection_get_item(
|
||||
|
||||
Reference in New Issue
Block a user