TransactWriteItems with Update.
(dynamodb_client, hash_table)
| 51 | resp = dynamodb_client.get_item(TableName=hash_table, Key={"pk": {"S": "del-1"}}) |
| 52 | assert "Item" not in resp |
| 53 | def test_transact_write_update(dynamodb_client, hash_table): |
| 54 | """TransactWriteItems with Update.""" |
| 55 | dynamodb_client.put_item(TableName=hash_table, Item={"pk": {"S": "upd-1"}, "counter": {"N": "0"}}) |
| 56 | dynamodb_client.transact_write_items( |
| 57 | TransactItems=[ |
| 58 | { |
| 59 | "Update": { |
| 60 | "TableName": hash_table, |
| 61 | "Key": {"pk": {"S": "upd-1"}}, |
| 62 | "UpdateExpression": "SET #c = #c + :inc", |
| 63 | "ExpressionAttributeNames": {"#c": "counter"}, |
| 64 | "ExpressionAttributeValues": {":inc": {"N": "5"}}, |
| 65 | } |
| 66 | } |
| 67 | ] |
| 68 | ) |
| 69 | resp = dynamodb_client.get_item(TableName=hash_table, Key={"pk": {"S": "upd-1"}}) |
| 70 | assert resp["Item"]["counter"]["N"] == "5" |
| 71 | def test_transact_write_condition_check_pass(dynamodb_client, hash_table): |
| 72 | """TransactWriteItems with ConditionCheck that passes.""" |
| 73 | dynamodb_client.put_item(TableName=hash_table, Item={"pk": {"S": "cc-1"}, "status": {"S": "active"}}) |
nothing calls this directly
no test coverage detected