update layercake version
This commit is contained in:
@@ -93,33 +93,30 @@ def test_transact_write_items(
|
||||
):
|
||||
class EmailConflictError(Exception): ...
|
||||
|
||||
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):
|
||||
transact.write_items()
|
||||
with pytest.raises(EmailConflictError):
|
||||
with dynamodb_persistence_layer.transact_writer(flush_amount=2) as transact:
|
||||
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,
|
||||
)
|
||||
|
||||
|
||||
def test_collection_get_item(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
):
|
||||
collect = dynamodb_persistence_layer.collect
|
||||
data_notfound = collect.get_item(
|
||||
collection = dynamodb_persistence_layer.collection
|
||||
data_notfound = collection.get_item(
|
||||
KeyPair(
|
||||
pk='5OxmMjL-ujoR5IMGegQz',
|
||||
sk='tenant',
|
||||
@@ -130,7 +127,7 @@ def test_collection_get_item(
|
||||
assert data_notfound == {}
|
||||
|
||||
# This data was added from seeds
|
||||
data = collect.get_item(
|
||||
data = collection.get_item(
|
||||
KeyPair(
|
||||
pk='5OxmMjL-ujoR5IMGegQz',
|
||||
sk=ComposeKey('sergio@somosbeta.com.br', prefix='emails'),
|
||||
@@ -150,7 +147,7 @@ def test_collection_get_item(
|
||||
class NotFoundError(Exception): ...
|
||||
|
||||
with pytest.raises(NotFoundError):
|
||||
collect.get_item(
|
||||
collection.get_item(
|
||||
KeyPair('5OxmMjL-ujoR5IMGegQz', 'notfound'),
|
||||
exc_cls=NotFoundError,
|
||||
)
|
||||
@@ -160,10 +157,10 @@ def test_collection_get_item_path_spec(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
):
|
||||
collect = dynamodb_persistence_layer.collect
|
||||
collection = dynamodb_persistence_layer.collection
|
||||
|
||||
# This data was added from seeds
|
||||
data = collect.get_item(
|
||||
data = collection.get_item(
|
||||
KeyPair(
|
||||
pk='5OxmMjL-ujoR5IMGegQz',
|
||||
sk=SortKey(
|
||||
|
||||
Reference in New Issue
Block a user