PEP8 cleanups.

This commit is contained in:
Roberto Rosario
2015-07-27 23:53:14 -04:00
parent 0b923a7a1c
commit 1e746c700a
101 changed files with 3244 additions and 892 deletions
+69 -20
View File
@@ -22,20 +22,29 @@ class DocumentsViewsFunctionalTestCase(TestCase):
"""
def setUp(self):
self.document_type = DocumentType.objects.create(label=TEST_DOCUMENT_TYPE)
self.document_type = DocumentType.objects.create(
label=TEST_DOCUMENT_TYPE
)
ocr_settings = self.document_type.ocr_settings
ocr_settings.auto_ocr = False
ocr_settings.save()
self.admin_user = User.objects.create_superuser(username=TEST_ADMIN_USERNAME, email=TEST_ADMIN_EMAIL, password=TEST_ADMIN_PASSWORD)
self.admin_user = User.objects.create_superuser(
username=TEST_ADMIN_USERNAME, email=TEST_ADMIN_EMAIL,
password=TEST_ADMIN_PASSWORD
)
self.client = Client()
# Login the admin user
logged_in = self.client.login(username=TEST_ADMIN_USERNAME, password=TEST_ADMIN_PASSWORD)
logged_in = self.client.login(
username=TEST_ADMIN_USERNAME, password=TEST_ADMIN_PASSWORD
)
self.assertTrue(logged_in)
self.assertTrue(self.admin_user.is_authenticated())
with open(TEST_SMALL_DOCUMENT_PATH) as file_object:
self.document = self.document_type.new_document(file_object=File(file_object), label='mayan_11_1.pdf')
self.document = self.document_type.new_document(
file_object=File(file_object), label='mayan_11_1.pdf'
)
def tearDown(self):
self.document_type.delete()
@@ -45,12 +54,16 @@ class DocumentsViewsFunctionalTestCase(TestCase):
self.assertEqual(Document.objects.count(), 1)
# Trash the document
self.client.post(reverse('documents:document_trash', args=[self.document.pk]))
self.client.post(
reverse('documents:document_trash', args=[self.document.pk])
)
self.assertEqual(DeletedDocument.objects.count(), 1)
self.assertEqual(Document.objects.count(), 0)
# Restore the document
self.client.post(reverse('documents:document_restore', args=[self.document.pk]))
self.client.post(
reverse('documents:document_restore', args=[self.document.pk])
)
self.assertEqual(DeletedDocument.objects.count(), 0)
self.assertEqual(Document.objects.count(), 1)
@@ -58,12 +71,16 @@ class DocumentsViewsFunctionalTestCase(TestCase):
self.assertEqual(Document.objects.count(), 1)
# Trash the document
self.client.post(reverse('documents:document_trash', args=[self.document.pk]))
self.client.post(
reverse('documents:document_trash', args=[self.document.pk])
)
self.assertEqual(DeletedDocument.objects.count(), 1)
self.assertEqual(Document.objects.count(), 0)
# Delete the document
self.client.post(reverse('documents:document_delete', args=[self.document.pk]))
self.client.post(
reverse('documents:document_delete', args=[self.document.pk])
)
self.assertEqual(DeletedDocument.objects.count(), 0)
self.assertEqual(Document.objects.count(), 0)
@@ -72,8 +89,12 @@ class DocumentsViewsFunctionalTestCase(TestCase):
self.assertContains(response, 'Total: 1', status_code=200)
# test document simple view
response = self.client.get(reverse('documents:document_properties', args=[self.document.pk]))
self.assertContains(response, 'roperties for document', status_code=200)
response = self.client.get(
reverse('documents:document_properties', args=[self.document.pk])
)
self.assertContains(
response, 'roperties for document', status_code=200
)
def test_document_type_views(self):
# Check that there are no document types
@@ -81,8 +102,12 @@ class DocumentsViewsFunctionalTestCase(TestCase):
self.assertContains(response, 'Total: 1', status_code=200)
# Create a document type
response = self.client.post(reverse('documents:document_type_create'), {'name': 'test document type 2'}, follow=True)
#TODO: FIX self.assertContains(response, 'successfully', status_code=200)
response = self.client.post(
reverse('documents:document_type_create'),
{'name': 'test document type 2'}, follow=True
)
#TODO: FIX
# self.assertContains(response, 'successfully', status_code=200)
# Check that there are two document types
response = self.client.get(reverse('documents:document_type_list'))
@@ -91,18 +116,42 @@ class DocumentsViewsFunctionalTestCase(TestCase):
self.assertEqual(self.document_type.label, TEST_DOCUMENT_TYPE)
# Edit the document type
response = self.client.post(reverse('documents:document_type_edit', args=[self.document_type.pk]), data={'name': TEST_DOCUMENT_TYPE + 'partial'}, follow=True)
#TODO: FIX self.assertContains(response, 'Document type edited successfully', status_code=200)
response = self.client.post(
reverse(
'documents:document_type_edit', args=[self.document_type.pk]
), data={'name': TEST_DOCUMENT_TYPE + 'partial'}, follow=True
)
#TODO: FIX
# self.assertContains(
# response, 'Document type edited successfully', status_code=200
#)
# Reload document type model data
#self.document_type = DocumentType.objects.get(pk=self.document_type.pk)
#TODO: FIX self.assertEqual(self.document_type.name, TEST_DOCUMENT_TYPE + 'partial')
#self.document_type = DocumentType.objects.get(
# pk=self.document_type.pk
#)
#TODO: FIX#
#self.assertEqual(
# self.document_type.name, TEST_DOCUMENT_TYPE + 'partial'
#)
# Delete the document type
response = self.client.post(reverse('documents:document_type_delete', args=[self.document_type.pk]), follow=True)
#TODO: FIX self.assertContains(response, 'Document type: {0} deleted successfully'.format(self.document_type.name), status_code=200)
#response = self.client.post(
# reverse(
# 'documents:document_type_delete', args=[self.document_type.pk]
# ), follow=True
#)
#TODO: FIX#
# self.assertContains(
# response, 'Document type: {0} deleted successfully'.format(
# self.document_type.name
# ), status_code=200
#)
# Check that there are no document types
response = self.client.get(reverse('documents:document_type_list'))
#response = self.client.get(reverse('documents:document_type_list'))
#TODO: FIX self.assertEqual(response.status_code, 200)
#TODO: FIX self.assertContains(response, 'ocument types (0)', status_code=200)
#TODO: FIX
#self.assertContains(
# response, 'ocument types (0)', status_code=200
#)