Testing new version of decorator.

This commit is contained in:
Steve Pulec 2017-02-15 22:35:45 -05:00
commit fde721bed7
123 changed files with 2740 additions and 1114 deletions

View file

@ -7,13 +7,13 @@ import requests
import tests.backport_assert_raises
from nose.tools import assert_raises
from moto import mock_dynamodb
from moto import mock_dynamodb, mock_dynamodb_deprecated
from moto.dynamodb import dynamodb_backend
from boto.exception import DynamoDBResponseError
@mock_dynamodb
@mock_dynamodb_deprecated
def test_list_tables():
name = 'TestTable'
dynamodb_backend.create_table(name, hash_key_attr="name", hash_key_type="S")
@ -21,7 +21,7 @@ def test_list_tables():
assert conn.list_tables() == ['TestTable']
@mock_dynamodb
@mock_dynamodb_deprecated
def test_list_tables_layer_1():
dynamodb_backend.create_table("test_1", hash_key_attr="name", hash_key_type="S")
dynamodb_backend.create_table("test_2", hash_key_attr="name", hash_key_type="S")
@ -35,7 +35,7 @@ def test_list_tables_layer_1():
res.should.equal(expected)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_describe_missing_table():
conn = boto.connect_dynamodb('the_key', 'the_secret')
with assert_raises(DynamoDBResponseError):
@ -49,7 +49,7 @@ def test_sts_handler():
res.text.should.contain("SecretAccessKey")
@mock_dynamodb
@mock_dynamodb_deprecated
def test_dynamodb_with_connect_to_region():
# this will work if connected with boto.connect_dynamodb()
dynamodb = boto.dynamodb.connect_to_region('us-west-2')

View file

@ -4,7 +4,7 @@ import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb
from moto import mock_dynamodb_deprecated
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError, DynamoDBValidationError
@ -29,7 +29,7 @@ def create_table(conn):
@freeze_time("2012-01-14")
@mock_dynamodb
@mock_dynamodb_deprecated
def test_create_table():
conn = boto.connect_dynamodb()
create_table(conn)
@ -60,7 +60,7 @@ def test_create_table():
conn.describe_table('messages').should.equal(expected)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_table():
conn = boto.connect_dynamodb()
create_table(conn)
@ -72,7 +72,7 @@ def test_delete_table():
conn.layer1.delete_table.when.called_with('messages').should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_update_table_throughput():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -86,7 +86,7 @@ def test_update_table_throughput():
table.write_units.should.equal(6)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_item_add_and_describe_and_update():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -133,7 +133,7 @@ def test_item_add_and_describe_and_update():
})
@mock_dynamodb
@mock_dynamodb_deprecated
def test_item_put_without_table():
conn = boto.connect_dynamodb()
@ -146,7 +146,7 @@ def test_item_put_without_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_get_missing_item():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -158,7 +158,7 @@ def test_get_missing_item():
table.has_item("foobar", "more").should.equal(False)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_get_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -171,7 +171,7 @@ def test_get_item_with_undeclared_table():
).should.throw(DynamoDBKeyNotFoundError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_get_item_without_range_key():
conn = boto.connect_dynamodb()
message_table_schema = conn.create_schema(
@ -195,7 +195,7 @@ def test_get_item_without_range_key():
table.get_item.when.called_with(hash_key=hash_key).should.throw(DynamoDBValidationError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_item():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -223,7 +223,7 @@ def test_delete_item():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_item_with_attribute_response():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -260,7 +260,7 @@ def test_delete_item_with_attribute_response():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -273,7 +273,7 @@ def test_delete_item_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_query():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -323,7 +323,7 @@ def test_query():
results.response['Items'].should.have.length_of(1)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_query_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -339,7 +339,7 @@ def test_query_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_scan():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -402,7 +402,7 @@ def test_scan():
results.response['Items'].should.have.length_of(1)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_scan_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -419,7 +419,7 @@ def test_scan_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_scan_after_has_item():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -430,7 +430,7 @@ def test_scan_after_has_item():
list(table.scan()).should.equal([])
@mock_dynamodb
@mock_dynamodb_deprecated
def test_write_batch():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -474,7 +474,7 @@ def test_write_batch():
table.item_count.should.equal(1)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_batch_read():
conn = boto.connect_dynamodb()
table = create_table(conn)

View file

@ -4,7 +4,7 @@ import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb
from moto import mock_dynamodb_deprecated
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
@ -27,7 +27,7 @@ def create_table(conn):
@freeze_time("2012-01-14")
@mock_dynamodb
@mock_dynamodb_deprecated
def test_create_table():
conn = boto.connect_dynamodb()
create_table(conn)
@ -54,7 +54,7 @@ def test_create_table():
conn.describe_table('messages').should.equal(expected)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_table():
conn = boto.connect_dynamodb()
create_table(conn)
@ -66,7 +66,7 @@ def test_delete_table():
conn.layer1.delete_table.when.called_with('messages').should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_update_table_throughput():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -80,7 +80,7 @@ def test_update_table_throughput():
table.write_units.should.equal(6)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_item_add_and_describe_and_update():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -120,7 +120,7 @@ def test_item_add_and_describe_and_update():
})
@mock_dynamodb
@mock_dynamodb_deprecated
def test_item_put_without_table():
conn = boto.connect_dynamodb()
@ -132,7 +132,7 @@ def test_item_put_without_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_get_missing_item():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -142,7 +142,7 @@ def test_get_missing_item():
).should.throw(DynamoDBKeyNotFoundError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_get_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -154,7 +154,7 @@ def test_get_item_with_undeclared_table():
).should.throw(DynamoDBKeyNotFoundError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_item():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -181,7 +181,7 @@ def test_delete_item():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_item_with_attribute_response():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -216,7 +216,7 @@ def test_delete_item_with_attribute_response():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_delete_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -228,7 +228,7 @@ def test_delete_item_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_query():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -248,7 +248,7 @@ def test_query():
results.response['Items'].should.have.length_of(1)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_query_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -258,7 +258,7 @@ def test_query_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_scan():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -318,7 +318,7 @@ def test_scan():
results.response['Items'].should.have.length_of(1)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_scan_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -335,7 +335,7 @@ def test_scan_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_scan_after_has_item():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -346,7 +346,7 @@ def test_scan_after_has_item():
list(table.scan()).should.equal([])
@mock_dynamodb
@mock_dynamodb_deprecated
def test_write_batch():
conn = boto.connect_dynamodb()
table = create_table(conn)
@ -388,7 +388,7 @@ def test_write_batch():
table.item_count.should.equal(1)
@mock_dynamodb
@mock_dynamodb_deprecated
def test_batch_read():
conn = boto.connect_dynamodb()
table = create_table(conn)