I want to use dynamodb local for local (unit) testing of my python/boto3 based application.
Now I can do something like this
if test_mode:
client = boto3.client("dynamodb", endpoint_url="localhost:8000")
resource = boto3.resource("dynamodb", endpoint_url="localhost:8000")
else:
client = boto3.client("dynamodb")
resource = boto3.resource("dynamodb")
But I would like to avoid the test_mode
check.
Can I somehow "prepare" boto3 so the dynamodb endpoint URL is set globally?
Update
To further explain what I want. I want some sort of function, where I can say:
boto3.setGlobalDynamodbEndpoint("http://localhost:8000")
such that when, after calling this function, I do:
client = boto3.client("dynamodb")
resource = boto3.resource("dynamodb")
The endpoint will automatically be set to "http://localhost:8000"