Skip to content

Commit 7286396

Browse files
Tom McCarthyheitorlessa
Tom McCarthy
andauthored
chore: alter example to move code inside test function
Co-authored-by: Heitor Lessa <lessa@amazon.co.uk>
1 parent 7f9dade commit 7286396

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/utilities/idempotency.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -814,12 +814,12 @@ To test with [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/
814814

815815
import app
816816

817-
# Create our own Table resource using the endpoint for our DynamoDB Local instance
818-
resource = boto3.resource("dynamodb", endpoint_url='http://localhost:8000')
819-
table = resource.Table(app.persistence_layer.table_name)
820-
app.persistence_layer.table = table
821-
822817
def test_idempotent_lambda():
818+
# Create our own Table resource using the endpoint for our DynamoDB Local instance
819+
resource = boto3.resource("dynamodb", endpoint_url='http://localhost:8000')
820+
table = resource.Table(app.persistence_layer.table_name)
821+
app.persistence_layer.table = table
822+
823823
result = app.handler({'testkey': 'testvalue'}, {})
824824
assert result['payment_id'] == 12345
825825
```

0 commit comments

Comments
 (0)