Skip to content

Commit

Permalink
Patch the dynamodb client when using DynamoDBLocal since DescribeTTL …
Browse files Browse the repository at this point in the history
…is unsupported #113
  • Loading branch information
numberoverzero committed Apr 7, 2018
1 parent dd056c2 commit 7720d11
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/integ/conftest.py
Expand Up @@ -22,6 +22,17 @@
DYNAMODB_LOCAL_SINGLETON = None


class PatchedDynamoDBClient:
def __init__(self, real_client):
self.__client = real_client

def describe_time_to_live(self, **_):
return {"TimeToLiveDescription": {"TimeToLiveStatus": "DISABLED"}}

def __getattr__(self, name):
return getattr(self.__client, name)


class DynamoDBLocal:
def __init__(self, localdir: str) -> None:
self.localdir = localdir
Expand Down Expand Up @@ -51,7 +62,10 @@ def clients(self) -> tuple:
session = self.session
endpoint = self.endpoint
return (
session.client("dynamodb", endpoint_url=endpoint),
# TODO | have to patch dynamodb until DynamoDBLocal supports DescribeTimeToLive
# TODO | otherwise, SessionWrapper.describe_table throws UnknownOperationException
PatchedDynamoDBClient(session.client("dynamodb", endpoint_url=endpoint)),

session.client("dynamodbstreams", endpoint_url=endpoint)
)

Expand Down

0 comments on commit 7720d11

Please sign in to comment.