Fix test failures in server mode

This commit is contained in:
Karl Gutwin 2018-11-08 13:57:44 -05:00
parent 9d190aa04e
commit e7b01292e9
3 changed files with 13 additions and 6 deletions

View File

@ -174,7 +174,11 @@ class DynamoHandler(BaseResponse):
throughput = self.body["ProvisionedThroughput"] throughput = self.body["ProvisionedThroughput"]
table = self.dynamodb_backend.update_table_throughput(name, throughput) table = self.dynamodb_backend.update_table_throughput(name, throughput)
if 'StreamSpecification' in self.body: if 'StreamSpecification' in self.body:
try:
table = self.dynamodb_backend.update_table_streams(name, self.body['StreamSpecification']) table = self.dynamodb_backend.update_table_streams(name, self.body['StreamSpecification'])
except ValueError:
er = 'com.amazonaws.dynamodb.v20111205#ResourceInUseException'
return self.error(er, 'Cannot enable stream')
return dynamo_json_dump(table.describe()) return dynamo_json_dump(table.describe())

View File

@ -80,6 +80,9 @@ class DomainDispatcherApplication(object):
region = 'us-east-1' region = 'us-east-1'
if service == 'dynamodb': if service == 'dynamodb':
if environ['HTTP_X_AMZ_TARGET'].startswith('DynamoDBStreams'):
host = 'dynamodbstreams'
else:
dynamo_api_version = environ['HTTP_X_AMZ_TARGET'].split("_")[1].split(".")[0] dynamo_api_version = environ['HTTP_X_AMZ_TARGET'].split("_")[1].split(".")[0]
# If Newer API version, use dynamodb2 # If Newer API version, use dynamodb2
if dynamo_api_version > "20111205": if dynamo_api_version > "20111205":

View File

@ -180,7 +180,7 @@ class TestEdges():
assert 'LatestStreamLabel' in resp['TableDescription'] assert 'LatestStreamLabel' in resp['TableDescription']
# now try to enable it again # now try to enable it again
with assert_raises(ValueError): with assert_raises(conn.exceptions.ResourceInUseException):
resp = conn.update_table( resp = conn.update_table(
TableName='test-streams', TableName='test-streams',
StreamSpecification={ StreamSpecification={