Support Python 3 using six

This commit is contained in:
David Baumgold 2014-08-26 13:25:50 -04:00
commit eedb4c4b73
67 changed files with 455 additions and 255 deletions

View file

@ -1,10 +1,11 @@
from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from boto.exception import JSONResponseError
from moto import mock_dynamodb2
from tests.helpers import requires_boto_gte
from tests.helpers import requires_boto_gte, py3_requires_boto_gte
try:
from boto.dynamodb2.fields import HashKey
from boto.dynamodb2.table import Table
@ -24,6 +25,7 @@ def create_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
@freeze_time("2012-01-14")
def test_create_table():
@ -55,6 +57,7 @@ def test_create_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_table():
create_table()
@ -68,6 +71,7 @@ def test_delete_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_update_table_throughput():
table = create_table()
@ -84,6 +88,7 @@ def test_update_table_throughput():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_item_add_and_describe_and_update():
table = create_table()
@ -118,6 +123,7 @@ def test_item_add_and_describe_and_update():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_item_put_without_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -133,6 +139,7 @@ def test_item_put_without_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_missing_item():
table = create_table()
@ -141,6 +148,7 @@ def test_get_missing_item():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_item_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -152,6 +160,7 @@ def test_get_item_with_undeclared_table():
@requires_boto_gte("2.30.0")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_item():
table = create_table()
@ -176,6 +185,7 @@ def test_delete_item():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_delete_item_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -187,6 +197,7 @@ def test_delete_item_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_query():
table = create_table()
@ -207,6 +218,7 @@ def test_query():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_query_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -218,6 +230,7 @@ def test_query_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_scan():
table = create_table()
@ -269,6 +282,7 @@ def test_scan():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_scan_with_undeclared_table():
conn = boto.dynamodb2.layer1.DynamoDBConnection()
@ -287,6 +301,7 @@ def test_scan_with_undeclared_table():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_write_batch():
table = create_table()
@ -318,6 +333,7 @@ def test_write_batch():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_batch_read():
table = create_table()
@ -359,6 +375,7 @@ def test_batch_read():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_key_fields():
table = create_table()
@ -367,6 +384,7 @@ def test_get_key_fields():
@requires_boto_gte("2.9")
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb2
def test_get_special_item():
table = Table.create('messages', schema=[