Removed extra white space. [ci skip]

pull/57/head
Fabio Caccamo 2019-02-06 16:22:27 +01:00
parent 4e0c4a00e2
commit 1870635697
1 changed files with 24 additions and 24 deletions

View File

@ -28,10 +28,10 @@ class AdminInterfaceTestCase(TestCase):
def __test_active_theme(self): def __test_active_theme(self):
theme = Theme.get_active_theme() theme = Theme.get_active_theme()
print( theme ) print(theme)
self.assertTrue(theme != None) self.assertTrue(theme != None)
self.assertTrue(theme.active) self.assertTrue(theme.active)
self.assertEqual(Theme.objects.filter( active = True ).count(), 1); self.assertEqual(Theme.objects.filter(active=True).count(), 1);
def test_default_theme_created_if_no_themes(self): def test_default_theme_created_if_no_themes(self):
Theme.objects.all().delete() Theme.objects.all().delete()
@ -50,47 +50,47 @@ class AdminInterfaceTestCase(TestCase):
def test_default_theme_activated_after_update_if_no_active_themes(self): def test_default_theme_activated_after_update_if_no_active_themes(self):
Theme.objects.all().delete() Theme.objects.all().delete()
Theme.objects.all().update( active = False ) Theme.objects.all().update(active=False)
self.__test_active_theme() self.__test_active_theme()
def test_default_theme_activated_after_update_if_multiple_active_themes(self): def test_default_theme_activated_after_update_if_multiple_active_themes(self):
Theme.objects.all().delete() Theme.objects.all().delete()
theme_1 = Theme.objects.create( name = 'Custom 1', active = True ) theme_1 = Theme.objects.create(name='Custom 1', active=True)
theme_2 = Theme.objects.create( name = 'Custom 2', active = True ) theme_2 = Theme.objects.create(name='Custom 2', active=True)
theme_3 = Theme.objects.create( name = 'Custom 3', active = True ) theme_3 = Theme.objects.create(name='Custom 3', active=True)
Theme.objects.update( active = False ) Theme.objects.update(active=False)
Theme.objects.update( active = True ) Theme.objects.update(active=True)
self.__test_active_theme() self.__test_active_theme()
def test_default_theme_activated_on_active_theme_deleted(self): def test_default_theme_activated_on_active_theme_deleted(self):
Theme.objects.all().delete() Theme.objects.all().delete()
theme_1 = Theme.objects.create( name = 'Custom 1', active = True ) theme_1 = Theme.objects.create(name='Custom 1', active=True)
theme_2 = Theme.objects.create( name = 'Custom 2', active = True ) theme_2 = Theme.objects.create(name='Custom 2', active=True)
theme_3 = Theme.objects.create( name = 'Custom 3', active = True ) theme_3 = Theme.objects.create(name='Custom 3', active=True)
Theme.objects.filter( pk = Theme.get_active_theme().pk ).delete() Theme.objects.filter(pk=Theme.get_active_theme().pk).delete()
self.__test_active_theme() self.__test_active_theme()
def test_last_theme_activated_on_multiple_themes_created(self): def test_last_theme_activated_on_multiple_themes_created(self):
Theme.objects.all().delete() Theme.objects.all().delete()
theme_1 = Theme.objects.create( name = 'Custom 1', active = True ) theme_1 = Theme.objects.create(name='Custom 1', active=True)
theme_2 = Theme.objects.create( name = 'Custom 2', active = True ) theme_2 = Theme.objects.create(name='Custom 2', active=True)
theme_3 = Theme.objects.create( name = 'Custom 3', active = True ) theme_3 = Theme.objects.create(name='Custom 3', active=True)
self.assertEqual( Theme.get_active_theme().pk, theme_3.pk ) self.assertEqual(Theme.get_active_theme().pk, theme_3.pk)
self.__test_active_theme() self.__test_active_theme()
def test_last_theme_activated_on_multiple_themes_activated(self): def test_last_theme_activated_on_multiple_themes_activated(self):
Theme.objects.all().delete() Theme.objects.all().delete()
theme_1 = Theme.objects.create( name = 'Custom 1', active = True ) theme_1 = Theme.objects.create(name='Custom 1', active=True)
theme_2 = Theme.objects.create( name = 'Custom 2', active = True ) theme_2 = Theme.objects.create(name='Custom 2', active=True)
theme_3 = Theme.objects.create( name = 'Custom 3', active = True ) theme_3 = Theme.objects.create(name='Custom 3', active=True)
theme_4 = Theme.objects.create( name = 'Custom 4', active = True ) theme_4 = Theme.objects.create(name='Custom 4', active=True)
theme_5 = Theme.objects.create( name = 'Custom 5', active = True ) theme_5 = Theme.objects.create(name='Custom 5', active=True)
themes = [ theme_1, theme_2, theme_3, theme_4, theme_5 ] themes = [theme_1, theme_2, theme_3, theme_4, theme_5]
for i in range(5): for i in range(5):
random.shuffle(themes) random.shuffle(themes)
for theme in themes: for theme in themes:
theme.set_active() theme.set_active()
self.assertEqual( Theme.get_active_theme().pk, theme.pk ) self.assertEqual(Theme.get_active_theme().pk, theme.pk)
self.__test_active_theme() self.__test_active_theme()
def test_templatetags_get_theme(self): def test_templatetags_get_theme(self):
@ -128,5 +128,5 @@ class AdminInterfaceTestCase(TestCase):
def test_repr(self): def test_repr(self):
theme = Theme.get_active_theme() theme = Theme.get_active_theme()
self.assertEqual( '{0}'.format(theme), 'Django' ) self.assertEqual('{0}'.format(theme), 'Django')