use requires_boto_gte instead of removing the earlier versions
This commit is contained in:
parent
a31664ade7
commit
b31c3ab8a5
@ -9,6 +9,8 @@ env:
|
||||
- BOTO_VERSION=2.11.0
|
||||
- BOTO_VERSION=2.10.0
|
||||
- BOTO_VERSION=2.9.9
|
||||
- BOTO_VERSION=2.8
|
||||
- BOTO_VERSION=2.7
|
||||
install:
|
||||
- pip install boto==$BOTO_VERSION
|
||||
- pip install https://github.com/gabrielfalcao/HTTPretty/tarball/8bbbdfc14326678b1aeba6a2d81af0d835a2cd6f
|
||||
|
@ -5,8 +5,10 @@ import boto.dynamodb2
|
||||
from moto import mock_dynamodb2
|
||||
from moto.dynamodb2 import dynamodb_backend2
|
||||
from boto.exception import JSONResponseError
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_list_tables():
|
||||
name = 'TestTable'
|
||||
@ -22,6 +24,7 @@ def test_list_tables():
|
||||
assert conn.list_tables()["TableNames"] == [name]
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_list_tables_layer_1():
|
||||
dynamodb_backend2.create_table("test_1",schema=[
|
||||
@ -44,6 +47,7 @@ def test_list_tables_layer_1():
|
||||
res.should.equal(expected)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_describe_missing_table():
|
||||
conn = boto.dynamodb2.connect_to_region(
|
||||
@ -53,6 +57,7 @@ def test_describe_missing_table():
|
||||
conn.describe_table.when.called_with('messages').should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_sts_handler():
|
||||
res = requests.post("https://sts.amazonaws.com/", data={"GetSessionToken": ""})
|
||||
|
@ -10,6 +10,7 @@ from boto.dynamodb.exceptions import DynamoDBKeyNotFoundError
|
||||
from boto.dynamodb2.exceptions import ValidationException
|
||||
from boto.dynamodb2.exceptions import ConditionalCheckFailedException
|
||||
from boto.exception import JSONResponseError
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
def create_table():
|
||||
table = Table.create('messages', schema=[
|
||||
@ -26,8 +27,10 @@ def iterate_results(res):
|
||||
print i
|
||||
|
||||
|
||||
@freeze_time("2012-01-14")
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
@freeze_time("2012-01-14")
|
||||
def test_create_table():
|
||||
table = create_table()
|
||||
expected = {
|
||||
@ -52,6 +55,7 @@ def test_create_table():
|
||||
table.describe().should.equal(expected)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_delete_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -63,6 +67,7 @@ def test_delete_table():
|
||||
conn.delete_table.when.called_with('messages').should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_update_table_throughput():
|
||||
table = create_table()
|
||||
@ -87,6 +92,7 @@ def test_update_table_throughput():
|
||||
table.throughput["write"].should.equal(6)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_item_add_and_describe_and_update():
|
||||
table = create_table()
|
||||
@ -129,6 +135,7 @@ def test_item_add_and_describe_and_update():
|
||||
})
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_item_put_without_table():
|
||||
|
||||
@ -143,6 +150,7 @@ def test_item_put_without_table():
|
||||
item.save.when.called_with().should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_missing_item():
|
||||
|
||||
@ -154,12 +162,14 @@ def test_get_missing_item():
|
||||
).should.throw(ValidationException)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_item_with_undeclared_table():
|
||||
table = Table('undeclared-table')
|
||||
table.get_item.when.called_with(test_hash=3241526475).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_item_without_range_key():
|
||||
table = Table.create('messages', schema=[
|
||||
@ -176,6 +186,7 @@ def test_get_item_without_range_key():
|
||||
table.get_item.when.called_with(test_hash=hash_key).should.throw(ValidationException)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_delete_item():
|
||||
table = create_table()
|
||||
@ -197,6 +208,7 @@ def test_delete_item():
|
||||
item.delete.when.called_with().should.throw(ConditionalCheckFailedException)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_delete_item_with_undeclared_table():
|
||||
conn = boto.connect_dynamodb()
|
||||
@ -211,6 +223,7 @@ def test_delete_item_with_undeclared_table():
|
||||
item.delete.when.called_with().should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_query():
|
||||
|
||||
@ -259,6 +272,7 @@ def test_query():
|
||||
sum(1 for _ in results).should.equal(1)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_query_with_undeclared_table():
|
||||
table = Table('undeclared')
|
||||
@ -270,6 +284,7 @@ def test_query_with_undeclared_table():
|
||||
iterate_results.when.called_with(results).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_scan():
|
||||
table = create_table()
|
||||
@ -324,6 +339,7 @@ def test_scan():
|
||||
sum(1 for _ in results).should.equal(1)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_scan_with_undeclared_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -340,6 +356,7 @@ def test_scan_with_undeclared_table():
|
||||
).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_write_batch():
|
||||
table = create_table()
|
||||
@ -369,6 +386,7 @@ def test_write_batch():
|
||||
table.count().should.equal(1)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_batch_read():
|
||||
table = create_table()
|
||||
@ -408,8 +426,9 @@ def test_batch_read():
|
||||
count = len([x for x in results])
|
||||
count.should.equal(2)
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_key_fields():
|
||||
table = create_table()
|
||||
kf = table.get_key_fields()
|
||||
kf.should.equal(['forum_name','subject'])
|
||||
kf.should.equal(['forum_name','subject'])
|
||||
|
@ -7,6 +7,7 @@ from boto.dynamodb2.fields import HashKey
|
||||
from boto.dynamodb2.fields import RangeKey
|
||||
from boto.dynamodb2.table import Table
|
||||
from boto.dynamodb2.table import Item
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
def create_table():
|
||||
table = Table.create('messages', schema=[
|
||||
@ -18,8 +19,10 @@ def create_table():
|
||||
return table
|
||||
|
||||
|
||||
@freeze_time("2012-01-14")
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
@freeze_time("2012-01-14")
|
||||
def test_create_table():
|
||||
table = create_table()
|
||||
expected = {
|
||||
@ -47,6 +50,7 @@ def test_create_table():
|
||||
conn.describe_table('messages').should.equal(expected)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_delete_table():
|
||||
create_table()
|
||||
@ -59,6 +63,7 @@ def test_delete_table():
|
||||
conn.delete_table.when.called_with('messages').should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_update_table_throughput():
|
||||
table = create_table()
|
||||
@ -75,6 +80,7 @@ def test_update_table_throughput():
|
||||
table.throughput["write"].should.equal(6)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_item_add_and_describe_and_update():
|
||||
table = create_table()
|
||||
@ -108,6 +114,7 @@ def test_item_add_and_describe_and_update():
|
||||
})
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_item_put_without_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -122,6 +129,7 @@ def test_item_put_without_table():
|
||||
).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_missing_item():
|
||||
table = create_table()
|
||||
@ -129,6 +137,7 @@ def test_get_missing_item():
|
||||
table.get_item.when.called_with(test_hash=3241526475).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_item_with_undeclared_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -139,6 +148,7 @@ def test_get_item_with_undeclared_table():
|
||||
).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_delete_item():
|
||||
table = create_table()
|
||||
@ -162,6 +172,7 @@ def test_delete_item():
|
||||
item.delete.when.called_with().should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_delete_item_with_undeclared_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -172,6 +183,7 @@ def test_delete_item_with_undeclared_table():
|
||||
).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_query():
|
||||
table = create_table()
|
||||
@ -191,6 +203,7 @@ def test_query():
|
||||
sum(1 for _ in results).should.equal(1)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_query_with_undeclared_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -201,6 +214,7 @@ def test_query_with_undeclared_table():
|
||||
).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_scan():
|
||||
table = create_table()
|
||||
@ -251,6 +265,7 @@ def test_scan():
|
||||
sum(1 for _ in results).should.equal(1)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_scan_with_undeclared_table():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
@ -268,6 +283,7 @@ def test_scan_with_undeclared_table():
|
||||
).should.throw(JSONResponseError)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_write_batch():
|
||||
table = create_table()
|
||||
@ -298,6 +314,7 @@ def test_write_batch():
|
||||
table.count().should.equal(1)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_batch_read():
|
||||
table = create_table()
|
||||
@ -335,6 +352,7 @@ def test_batch_read():
|
||||
count.should.equal(2)
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_key_fields():
|
||||
table = create_table()
|
||||
@ -342,6 +360,7 @@ def test_get_key_fields():
|
||||
kf[0].should.equal('forum_name')
|
||||
|
||||
|
||||
@requires_boto_gte("2.9")
|
||||
@mock_dynamodb2
|
||||
def test_get_special_item():
|
||||
table = Table.create('messages', schema=[
|
||||
|
Loading…
Reference in New Issue
Block a user