ADD: support for pylint.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
import datetime
|
||||
import mock
|
||||
import re
|
||||
import socket
|
||||
import unittest
|
||||
import mock
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from ..views import RootView
|
||||
@@ -39,20 +39,20 @@ class RootUnitTestCase(unittest.TestCase):
|
||||
expected_color_hex = default_color_hex
|
||||
|
||||
with mock.patch('socket.gethostname', return_value=hostname):
|
||||
v = RootView()
|
||||
view = RootView()
|
||||
if 'kwargs' in test_data:
|
||||
c = v.get_context_data(**test_data['kwargs'])
|
||||
ctx = view.get_context_data(**test_data['kwargs'])
|
||||
else:
|
||||
c = v.get_context_data()
|
||||
ctx = view.get_context_data()
|
||||
|
||||
self.assertIsInstance(c, dict)
|
||||
self.assertIn('hostname', c)
|
||||
self.assertEqual(c['hostname'], hostname)
|
||||
self.assertIn('color_hex', c)
|
||||
self.assertTrue(re.match('[0-9a-f]{6}', c['color_hex']))
|
||||
self.assertEqual(c['color_hex'], expected_color_hex)
|
||||
self.assertIn('time', c)
|
||||
self.assertIsInstance(c['time'], datetime.datetime)
|
||||
self.assertIsInstance(ctx, dict)
|
||||
self.assertIn('hostname', ctx)
|
||||
self.assertEqual(ctx['hostname'], hostname)
|
||||
self.assertIn('color_hex', ctx)
|
||||
self.assertTrue(re.match('[0-9a-f]{6}', ctx['color_hex']))
|
||||
self.assertEqual(ctx['color_hex'], expected_color_hex)
|
||||
self.assertIn('time', ctx)
|
||||
self.assertIsInstance(ctx['time'], datetime.datetime)
|
||||
|
||||
|
||||
class DjangoAdminDjangoTestCase(SimpleTestCase):
|
||||
@@ -80,5 +80,3 @@ class RootDjangoTestCase(SimpleTestCase):
|
||||
response = self.client.get('/')
|
||||
hostname = socket.gethostname().capitalize()
|
||||
self.assertContains(response, hostname)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user