This commit is contained in:
Steve Pulec 2013-03-05 08:35:18 -05:00
parent 86a89f2495
commit e993917d4c
57 changed files with 53 additions and 71 deletions

View File

@ -7,8 +7,8 @@ from .utils import unix_time
class Table(object):
def __init__(self, name, hash_key_attr=None, hash_key_type=None,
range_key_attr=None, range_key_type=None, read_capacity=None,
write_capacity=None):
range_key_attr=None, range_key_type=None, read_capacity=None,
write_capacity=None):
self.name = name
self.hash_key_attr = hash_key_attr
self.hash_key_type = hash_key_type

View File

@ -7,4 +7,3 @@ from moto.ec2.utils import resource_ids_from_querystring
class AmazonDevPay(object):
def confirm_product_instance(self):
raise NotImplementedError('AmazonDevPay.confirm_product_instance is not yet implemented')

View File

@ -1,7 +1,6 @@
from jinja2 import Template
from moto.ec2.models import ec2_backend
from moto.ec2.utils import resource_ids_from_querystring
class AvailabilityZonesAndRegions(object):

View File

@ -13,4 +13,3 @@ class CustomerGateways(object):
def describe_customer_gateways(self):
raise NotImplementedError('CustomerGateways(AmazonVPC).describe_customer_gateways is not yet implemented')

View File

@ -16,4 +16,3 @@ class DHCPOptions(object):
def describe_dhcp_options(self):
raise NotImplementedError('DHCPOptions(AmazonVPC).describe_dhcp_options is not yet implemented')

View File

@ -19,4 +19,3 @@ class ElasticIPAddresses(object):
def release_address(self):
raise NotImplementedError('ElasticIPAddresses.release_address is not yet implemented')

View File

@ -28,4 +28,3 @@ class ElasticNetworkInterfaces(object):
def reset_network_interface_attribute(self):
raise NotImplementedError('ElasticNetworkInterfaces(AmazonVPC).reset_network_interface_attribute is not yet implemented')

View File

@ -7,4 +7,3 @@ from moto.ec2.utils import resource_ids_from_querystring
class General(object):
def get_console_output(self):
raise NotImplementedError('General.get_console_output is not yet implemented')

View File

@ -19,4 +19,3 @@ class InternetGateways(object):
def detach_internet_gateway(self):
raise NotImplementedError('InternetGateways(AmazonVPC).detach_internet_gateway is not yet implemented')

View File

@ -10,4 +10,3 @@ class IPAddresses(object):
def unassign_private_ip_addresses(self):
raise NotImplementedError('IPAddresses.unassign_private_ip_addresses is not yet implemented')

View File

@ -16,4 +16,3 @@ class KeyPairs(object):
def import_key_pair(self):
raise NotImplementedError('KeyPairs.import_key_pair is not yet implemented')

View File

@ -10,4 +10,3 @@ class Monitoring(object):
def unmonitor_instances(self):
raise NotImplementedError('Monitoring.unmonitor_instances is not yet implemented')

View File

@ -25,4 +25,3 @@ class NetworkACLs(object):
def replace_network_acl_entry(self):
raise NotImplementedError('NetworkACLs(AmazonVPC).replace_network_acl_entry is not yet implemented')

View File

@ -13,4 +13,3 @@ class PlacementGroups(object):
def describe_placement_groups(self):
raise NotImplementedError('PlacementGroups.describe_placement_groups is not yet implemented')

View File

@ -22,4 +22,3 @@ class ReservedInstances(object):
def purchase_reserved_instances_offering(self):
raise NotImplementedError('ReservedInstances.purchase_reserved_instances_offering is not yet implemented')

View File

@ -31,4 +31,3 @@ class RouteTables(object):
def replace_route_table_association(self):
raise NotImplementedError('RouteTables(AmazonVPC).replace_route_table_association is not yet implemented')

View File

@ -25,4 +25,3 @@ class SpotInstances(object):
def request_spot_instances(self):
raise NotImplementedError('SpotInstances.request_spot_instances is not yet implemented')

View File

@ -13,4 +13,3 @@ class Subnets(object):
def describe_subnets(self):
raise NotImplementedError('Subnets(AmazonVPC).describe_subnets is not yet implemented')

View File

@ -19,4 +19,3 @@ class VirtualPrivateGateways(object):
def detach_vpn_gateway(self):
raise NotImplementedError('VirtualPrivateGateways(AmazonVPC).detach_vpn_gateway is not yet implemented')

View File

@ -13,4 +13,3 @@ class VMExport(object):
def describe_export_tasks(self):
raise NotImplementedError('VMExport.describe_export_tasks is not yet implemented')

View File

@ -16,4 +16,3 @@ class VMImport(object):
def import_volume(self):
raise NotImplementedError('VMImport.import_volume is not yet implemented')

View File

@ -13,4 +13,3 @@ class VPCs(object):
def describe_vpcs(self):
raise NotImplementedError('VPCs(AmazonVPC).describe_vpcs is not yet implemented')

View File

@ -13,4 +13,3 @@ class VPNConnections(object):
def describe_vpn_connections(self):
raise NotImplementedError('VPNConnections(AmazonVPC).describe_vpn_connections is not yet implemented')

View File

@ -16,4 +16,3 @@ class Windows(object):
def get_password_data(self):
raise NotImplementedError('Windows.get_password_data is not yet implemented')

View File

@ -8,11 +8,11 @@ def random_hex(length):
def get_random_message_id():
return "{}-{}-{}-{}-{}-{}-{}".format(
random_hex(16),
random_hex(8),
random_hex(4),
random_hex(4),
random_hex(4),
random_hex(12),
random_hex(6),
random_hex(16),
random_hex(8),
random_hex(4),
random_hex(4),
random_hex(4),
random_hex(12),
random_hex(6),
)

View File

@ -89,8 +89,10 @@ class SQSBackend(BaseBackend):
def delete_message(self, queue_name, receipt_handle):
queue = self.get_queue(queue_name)
new_messages = [message for message in queue.messages
if message.receipt_handle != receipt_handle]
new_messages = [
message for message in queue.messages
if message.receipt_handle != receipt_handle
]
queue.message = new_messages

View File

@ -1,6 +1,6 @@
import boto
from boto.exception import EC2ResponseError
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2
@ -36,4 +36,4 @@ def test_decorator_start_and_stop():
list(conn.get_all_instances()).should.equal([])
mock.stop()
expect(conn.get_all_instances.when.called_with()).should.throw(EC2ResponseError)
conn.get_all_instances.when.called_with().should.throw(EC2ResponseError)

View File

@ -17,7 +17,8 @@ def test_list_tables():
@freeze_time("2012-01-14")
@mock_dynamodb
def test_describe_table():
dynamodb_backend.create_table('messages',
dynamodb_backend.create_table(
'messages',
hash_key_attr='forum_name',
hash_key_type='S',
range_key_attr='subject',

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,7 +1,7 @@
import boto
from boto.exception import EC2ResponseError
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2
@ -36,4 +36,4 @@ def test_ami_pulls_attributes_from_instance():
image_id = conn.create_image(instance.id, "test-ami", "this is a test ami")
image = conn.get_image(image_id)
expect(image.kernel_id).should.equal('test-kernel')
image.kernel_id.should.equal('test-kernel')

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -4,5 +4,7 @@ from moto import mock_ec2
@mock_ec2
def test_not_implemented_method():
requests.post.when.called_with("https://ec2.us-east-1.amazonaws.com/",
data={'Action': ['foobar']}).should.throw(NotImplementedError)
requests.post.when.called_with(
"https://ec2.us-east-1.amazonaws.com/",
data={'Action': ['foobar']}
).should.throw(NotImplementedError)

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,6 +1,6 @@
import boto
from boto.exception import EC2ResponseError
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2
@ -10,7 +10,7 @@ def test_create_and_describe_security_group():
conn = boto.connect_ec2('the_key', 'the_secret')
security_group = conn.create_security_group('test security group', 'this is a test security group')
expect(security_group.name).should.equal('test security group')
security_group.name.should.equal('test security group')
security_group.description.should.equal('this is a test security group')
# Trying to create another group with the same name should throw an error

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -1,5 +1,5 @@
import boto
from sure import expect
import sure # flake8: noqa
from moto import mock_ec2

View File

@ -5,7 +5,7 @@ from boto.exception import S3ResponseError
from boto.s3.key import Key
import requests
from sure import expect
import sure # flake8: noqa
from moto import mock_s3
@ -33,7 +33,7 @@ def test_my_model_save():
model_instance = MyModel('steve', 'is awesome')
model_instance.save()
expect(conn.get_bucket('mybucket').get_key('steve').get_contents_as_string()).should.equal('is awesome')
conn.get_bucket('mybucket').get_key('steve').get_contents_as_string().should.equal('is awesome')
@mock_s3

View File

@ -3,7 +3,7 @@ import email
import boto
from boto.exception import BotoServerError
from sure import expect
import sure # flake8: noqa
from moto import mock_ses

View File

@ -1,7 +1,7 @@
import boto
from boto.exception import SQSError
import requests
from sure import expect
import sure # flake8: noqa
from moto import mock_sqs
@ -12,7 +12,7 @@ def test_create_queue():
conn.create_queue("test-queue", visibility_timeout=60)
all_queues = conn.get_all_queues()
expect(all_queues[0].name).should.equal("test-queue")
all_queues[0].name.should.equal("test-queue")
all_queues[0].get_timeout().should.equal(60)