From 21bb49fb3ab9c667d24592e035b76243dcef3c72 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Fri, 4 Mar 2016 09:37:15 -0500 Subject: [PATCH] Test for the ResourceInUse exception when double creating --- tests/api_tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/api_tests.py b/tests/api_tests.py index 15c1116..d585aa7 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -129,6 +129,17 @@ class CreateTableTests(AsyncTestCase): with self.assertRaises(exceptions.ValidationException): yield self.client.create_table(definition) + @testing.gen_test + def test_double_create(self): + definition = self.generic_table_definition() + response = yield self.client.create_table(definition) + self.assertEqual(response['TableName'], definition['TableName']) + self.assertIn(response['TableStatus'], + [dynamodb.TABLE_ACTIVE, + dynamodb.TABLE_CREATING]) + with self.assertRaises(exceptions.ResourceInUse): + response = yield self.client.create_table(definition) + class DeleteTableTests(AsyncTestCase):