We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#7523
Original issue was closed due to no reproducible test case
import pytest import boto3 from moto import mock_aws from botocore.exceptions import ClientError @mock_aws def test_transact_write_condition_check_failure(): dynamodb = boto3.resource("dynamodb") client = boto3.client("dynamodb") table_name = "test-table" table = dynamodb.create_table( TableName=table_name, KeySchema=[{"AttributeName": "pk", "KeyType": "HASH"}], AttributeDefinitions=[{"AttributeName": "pk", "AttributeType": "S"}], BillingMode="PAY_PER_REQUEST" ) table.put_item(Item={"pk": "key1", "foo": "bar"}) try: client.transact_write_items( TransactItems=[ { "ConditionCheck": { "TableName": table_name, "Key": {"pk": {"S": "key1"}}, "ConditionExpression": "foo = :expected", "ExpressionAttributeValues": {":expected": {"S": "nonexistent"}}, "ReturnValuesOnConditionCheckFailure": "ALL_OLD" } } ] ) pytest.fail("Expected TransactionCanceledException was not raised") except ClientError as e: error_code = e.response["Error"]["Code"] assert error_code == "TransactionCanceledException", f"Unexpected error code: {error_code}" cancellation_reasons = e.response.get("CancellationReasons", []) assert any( reason.get("Item") is not None for reason in cancellation_reasons ), "No cancellation reasons contain the 'Item' key"
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
#7523
Original issue was closed due to no reproducible test case
The text was updated successfully, but these errors were encountered: