start pep8 cleanup

This commit is contained in:
Steve Pulec 2013-02-26 00:12:34 -05:00
parent 024624045f
commit bcbec29653
7 changed files with 9 additions and 56 deletions

View File

@ -1 +1 @@
from .models import BaseBackend
from .models import BaseBackend

View File

@ -247,7 +247,6 @@ class fakesock(object):
return self.fd
def _true_sendall(self, data, *args, **kw):
import pdb;pdb.set_trace()
self.truesock.connect(self._address)
self.truesock.sendall(data, *args, **kw)
_d = self.truesock.recv(16)
@ -266,7 +265,6 @@ class fakesock(object):
hostnames = [getattr(i.info, 'hostname', None) for i in HTTPretty._entries.keys()]
self.fd.seek(0)
try:
#print("data", data)
requestline, _ = data.split('\r\n', 1)
method, path, version = parse_requestline(requestline)
is_parsing_headers = True

View File

@ -1,5 +1,3 @@
import md5
from moto.core import BaseBackend
from .utils import get_random_message_id

View File

@ -1,29 +1,9 @@
import re
from urlparse import parse_qs
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
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):
def verify_email_identity(self):

View File

@ -1,32 +1,10 @@
import re
from urlparse import parse_qs
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
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):
def create_queue(self):
@ -56,7 +34,7 @@ class QueueResponse(BaseResponse):
queue_name = self.path.split("/")[-1]
key = camelcase_to_underscores(self.querystring.get('Attribute.Name')[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
def delete_queue(self):
@ -136,7 +114,7 @@ class QueueResponse(BaseResponse):
# Found all messages
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 = self.querystring.get(message_user_id_key)[0]

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python
import sys
from setuptools import setup, find_packages
setup(
name='moto',
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_email='spulec@gmail',
url='https://github.com/spulec/moto',
@ -14,4 +14,4 @@ setup(
install_requires=[
"boto"
],
)
)

View File

@ -1,6 +1,5 @@
import boto
from boto.exception import SQSError
import requests
from sure import expect