start pep8 cleanup
This commit is contained in:
parent
024624045f
commit
bcbec29653
@ -1 +1 @@
|
|||||||
from .models import BaseBackend
|
from .models import BaseBackend
|
||||||
|
@ -247,7 +247,6 @@ class fakesock(object):
|
|||||||
return self.fd
|
return self.fd
|
||||||
|
|
||||||
def _true_sendall(self, data, *args, **kw):
|
def _true_sendall(self, data, *args, **kw):
|
||||||
import pdb;pdb.set_trace()
|
|
||||||
self.truesock.connect(self._address)
|
self.truesock.connect(self._address)
|
||||||
self.truesock.sendall(data, *args, **kw)
|
self.truesock.sendall(data, *args, **kw)
|
||||||
_d = self.truesock.recv(16)
|
_d = self.truesock.recv(16)
|
||||||
@ -266,7 +265,6 @@ class fakesock(object):
|
|||||||
hostnames = [getattr(i.info, 'hostname', None) for i in HTTPretty._entries.keys()]
|
hostnames = [getattr(i.info, 'hostname', None) for i in HTTPretty._entries.keys()]
|
||||||
self.fd.seek(0)
|
self.fd.seek(0)
|
||||||
try:
|
try:
|
||||||
#print("data", data)
|
|
||||||
requestline, _ = data.split('\r\n', 1)
|
requestline, _ = data.split('\r\n', 1)
|
||||||
method, path, version = parse_requestline(requestline)
|
method, path, version = parse_requestline(requestline)
|
||||||
is_parsing_headers = True
|
is_parsing_headers = True
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import md5
|
|
||||||
|
|
||||||
from moto.core import BaseBackend
|
from moto.core import BaseBackend
|
||||||
from .utils import get_random_message_id
|
from .utils import get_random_message_id
|
||||||
|
|
||||||
|
@ -1,29 +1,9 @@
|
|||||||
import re
|
|
||||||
from urlparse import parse_qs
|
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
from moto.core.utils import headers_to_dict, camelcase_to_underscores, method_names_from_class
|
from moto.core.responses import BaseResponse
|
||||||
from .models import ses_backend
|
from .models import ses_backend
|
||||||
|
|
||||||
|
|
||||||
class BaseResponse(object):
|
|
||||||
def dispatch(self, uri, body, headers):
|
|
||||||
querystring = parse_qs(body)
|
|
||||||
|
|
||||||
self.path = uri.path
|
|
||||||
self.querystring = querystring
|
|
||||||
|
|
||||||
action = querystring['Action'][0]
|
|
||||||
action = camelcase_to_underscores(action)
|
|
||||||
|
|
||||||
method_names = method_names_from_class(self.__class__)
|
|
||||||
if action in method_names:
|
|
||||||
method = getattr(self, action)
|
|
||||||
return method()
|
|
||||||
raise NotImplementedError("The {} action has not been implemented".format(action))
|
|
||||||
|
|
||||||
|
|
||||||
class EmailResponse(BaseResponse):
|
class EmailResponse(BaseResponse):
|
||||||
|
|
||||||
def verify_email_identity(self):
|
def verify_email_identity(self):
|
||||||
|
@ -1,32 +1,10 @@
|
|||||||
import re
|
|
||||||
from urlparse import parse_qs
|
|
||||||
|
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
from moto.core.utils import headers_to_dict, camelcase_to_underscores, method_names_from_class
|
from moto.core.responses import BaseResponse
|
||||||
|
from moto.core.utils import camelcase_to_underscores
|
||||||
from .models import sqs_backend
|
from .models import sqs_backend
|
||||||
|
|
||||||
|
|
||||||
class BaseResponse(object):
|
|
||||||
def dispatch(self, uri, body, headers):
|
|
||||||
if body:
|
|
||||||
querystring = parse_qs(body)
|
|
||||||
else:
|
|
||||||
querystring = headers_to_dict(headers)
|
|
||||||
|
|
||||||
self.path = uri.path
|
|
||||||
self.querystring = querystring
|
|
||||||
|
|
||||||
action = querystring['Action'][0]
|
|
||||||
action = camelcase_to_underscores(action)
|
|
||||||
|
|
||||||
method_names = method_names_from_class(self.__class__)
|
|
||||||
if action in method_names:
|
|
||||||
method = getattr(self, action)
|
|
||||||
return method()
|
|
||||||
raise NotImplementedError("The {} action has not been implemented".format(action))
|
|
||||||
|
|
||||||
|
|
||||||
class QueuesResponse(BaseResponse):
|
class QueuesResponse(BaseResponse):
|
||||||
|
|
||||||
def create_queue(self):
|
def create_queue(self):
|
||||||
@ -56,7 +34,7 @@ class QueueResponse(BaseResponse):
|
|||||||
queue_name = self.path.split("/")[-1]
|
queue_name = self.path.split("/")[-1]
|
||||||
key = camelcase_to_underscores(self.querystring.get('Attribute.Name')[0])
|
key = camelcase_to_underscores(self.querystring.get('Attribute.Name')[0])
|
||||||
value = self.querystring.get('Attribute.Value')[0]
|
value = self.querystring.get('Attribute.Value')[0]
|
||||||
queue = sqs_backend.set_queue_attribute(queue_name, key, value)
|
sqs_backend.set_queue_attribute(queue_name, key, value)
|
||||||
return SET_QUEUE_ATTRIBUTE_RESPONSE
|
return SET_QUEUE_ATTRIBUTE_RESPONSE
|
||||||
|
|
||||||
def delete_queue(self):
|
def delete_queue(self):
|
||||||
@ -136,7 +114,7 @@ class QueueResponse(BaseResponse):
|
|||||||
# Found all messages
|
# Found all messages
|
||||||
break
|
break
|
||||||
|
|
||||||
message = sqs_backend.delete_message(queue_name, receipt_handle[0])
|
sqs_backend.delete_message(queue_name, receipt_handle[0])
|
||||||
|
|
||||||
message_user_id_key = 'DeleteMessageBatchRequestEntry.{}.Id'.format(index)
|
message_user_id_key = 'DeleteMessageBatchRequestEntry.{}.Id'.format(index)
|
||||||
message_user_id = self.querystring.get(message_user_id_key)[0]
|
message_user_id = self.querystring.get(message_user_id_key)[0]
|
||||||
|
6
setup.py
6
setup.py
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import sys
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='moto',
|
name='moto',
|
||||||
version='0.0.2',
|
version='0.0.2',
|
||||||
description='Moto is a library that allows your python tests to easily mock out the boto library',
|
description='Moto is a library that allows your python tests to easily mock'
|
||||||
|
' out the boto library',
|
||||||
author='Steve Pulec',
|
author='Steve Pulec',
|
||||||
author_email='spulec@gmail',
|
author_email='spulec@gmail',
|
||||||
url='https://github.com/spulec/moto',
|
url='https://github.com/spulec/moto',
|
||||||
@ -14,4 +14,4 @@ setup(
|
|||||||
install_requires=[
|
install_requires=[
|
||||||
"boto"
|
"boto"
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import boto
|
import boto
|
||||||
from boto.exception import SQSError
|
from boto.exception import SQSError
|
||||||
import requests
|
|
||||||
|
|
||||||
from sure import expect
|
from sure import expect
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user