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,9 +1,11 @@
from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from moto import mock_dynamodb
from tests.helpers import py3_requires_boto_gte
from boto.dynamodb import condition
from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
@ -25,6 +27,7 @@ def create_table(conn):
return table
@py3_requires_boto_gte("2.33.0")
@freeze_time("2012-01-14")
@mock_dynamodb
def test_create_table():
@ -53,6 +56,7 @@ def test_create_table():
conn.describe_table('messages').should.equal(expected)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_table():
conn = boto.connect_dynamodb()
@ -65,6 +69,7 @@ def test_delete_table():
conn.layer1.delete_table.when.called_with('messages').should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_update_table_throughput():
conn = boto.connect_dynamodb()
@ -79,6 +84,7 @@ def test_update_table_throughput():
table.write_units.should.equal(6)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_item_add_and_describe_and_update():
conn = boto.connect_dynamodb()
@ -119,6 +125,7 @@ def test_item_add_and_describe_and_update():
})
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_item_put_without_table():
conn = boto.connect_dynamodb()
@ -131,6 +138,7 @@ def test_item_put_without_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_missing_item():
conn = boto.connect_dynamodb()
@ -141,6 +149,7 @@ def test_get_missing_item():
).should.throw(DynamoDBKeyNotFoundError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_get_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -153,6 +162,7 @@ def test_get_item_with_undeclared_table():
).should.throw(DynamoDBKeyNotFoundError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item():
conn = boto.connect_dynamodb()
@ -180,6 +190,7 @@ def test_delete_item():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item_with_attribute_response():
conn = boto.connect_dynamodb()
@ -215,6 +226,7 @@ def test_delete_item_with_attribute_response():
item.delete.when.called_with().should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_delete_item_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -227,6 +239,7 @@ def test_delete_item_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_query():
conn = boto.connect_dynamodb()
@ -247,6 +260,7 @@ def test_query():
results.response['Items'].should.have.length_of(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_query_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -257,6 +271,7 @@ def test_query_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_scan():
conn = boto.connect_dynamodb()
@ -317,6 +332,7 @@ def test_scan():
results.response['Items'].should.have.length_of(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_scan_with_undeclared_table():
conn = boto.connect_dynamodb()
@ -334,6 +350,7 @@ def test_scan_with_undeclared_table():
).should.throw(DynamoDBResponseError)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_write_batch():
conn = boto.connect_dynamodb()
@ -376,6 +393,7 @@ def test_write_batch():
table.item_count.should.equal(1)
@py3_requires_boto_gte("2.33.0")
@mock_dynamodb
def test_batch_read():
conn = boto.connect_dynamodb()