Commit e83952d5 by Oleg Marshev

Fix pep8 violations.

parent d97c1ab8
[pep8]
ignore=E501
max_line_length=119
PACKAGES = notesserver notesapi
test: clean
./manage.py test --settings=notesserver.settings.test --with-coverage --cover-package=notesserver,notesapi \
./manage.py test --settings=notesserver.settings.test --with-coverage \
--exclude-dir=notesserver/settings --cover-inclusive --cover-branches \
--cover-html --cover-html-dir=coverage/html/ \
--cover-xml --cover-xml-file=coverage/coverage.xml
--cover-xml --cover-xml-file=coverage/coverage.xml \
$(foreach package,$(PACKAGES),--cover-package=$(package)) \
$(PACKAGES)
run:
./manage.py runserver 0.0.0.0:8042
......@@ -13,3 +17,5 @@ shell:
clean:
coverage erase
quality:
pep8 --config=.pep8 $(PACKAGES)
......@@ -4,6 +4,7 @@ class MockConsumer(object):
self.secret = 'top-secret'
self.ttl = 86400
class MockUser(object):
def __init__(self, id='alice', consumer=None):
self.id = id
......@@ -15,5 +16,6 @@ class MockAuthenticator(object):
def request_user(self, request):
return MockUser()
def mock_authorizer(*args, **kwargs):
return True
......@@ -65,11 +65,13 @@ class AnnotationViewTests(APITestCase):
self.assertIn('id', response.data, "annotation id should be returned in response")
expected_location = '/api/v1/annotations/{0}'.format(response.data['id'])
self.assertTrue(response['Location'].endswith(expected_location), "The response should have a Location header "
"with the URL to read the annotation that was created")
self.assertTrue(
response['Location'].endswith(expected_location),
"the response should have a Location header with the URL to read the annotation that was created"
)
#self.assertEqual(self.user.id, response.data['user'])
#self.assertEqual(self.user.consumer.key, response.data['consumer'])
# TODO: self.assertEqual(self.user.id, response.data['user'])
# TODO: self.assertEqual(self.user.consumer.key, response.data['consumer'])
def test_create_ignore_created(self):
"""
......
......@@ -69,7 +69,6 @@ class AnnotationListView(APIView):
refresh = request.QUERY_PARAMS.get('refresh') != u'false'
annotation.save(refresh=refresh)
location = reverse('api:v1:annotations_detail', kwargs={'annotation_id': annotation['id']})
return Response(annotation, status=status.HTTP_201_CREATED, headers={'Location': location})
......@@ -116,7 +115,6 @@ class AnnotationDetailView(APIView):
return Response(annotation)
def delete(self, request, *args, **kwargs):
"""
Delete an annotation.
......@@ -142,6 +140,7 @@ def _filter_input(annotation, fields):
return annotation
def _convert_str(value, default=None):
"""
Convert given value to string.
......
import os, json
import os
import json
DEBUG = False
TEMPLATE_DEBUG = False
......@@ -52,8 +53,9 @@ try:
AUTH_TOKENS = json.load(auth_file)
DATABASES = AUTH_TOKENS['DATABASES']
except IOError:
DATABASES = {'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
}
}
......@@ -2,6 +2,7 @@ from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
class OperationalEndpointsTest(APITestCase):
"""
Tests for operational endpoints.
......
......@@ -5,3 +5,5 @@ mock==1.0.1
coverage==3.7.1
nose-exclude==0.2.0
nose-ignore-docstring==0.2
pep8==1.5.7
pylint==1.4.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment