mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-18 14:08:04 +00:00
Rework with black
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
'''
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
Test various other parts of ivatar/libravatar in order
|
Test various other parts of ivatar/libravatar in order
|
||||||
to increase the overall test coverage. Test in here, didn't
|
to increase the overall test coverage. Test in here, didn't
|
||||||
fit anywhere else.
|
fit anywhere else.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@@ -12,35 +13,35 @@ from ivatar.ivataraccount.models import pil_format, UserPreference
|
|||||||
|
|
||||||
|
|
||||||
class Tester(TestCase):
|
class Tester(TestCase):
|
||||||
'''
|
"""
|
||||||
Main test class
|
Main test class
|
||||||
'''
|
"""
|
||||||
|
|
||||||
user = None
|
user = None
|
||||||
username = random_string()
|
username = random_string()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
'''
|
"""
|
||||||
Prepare tests.
|
Prepare tests.
|
||||||
- Create user
|
- Create user
|
||||||
'''
|
"""
|
||||||
self.user = User.objects.create_user(
|
self.user = User.objects.create_user(
|
||||||
username=self.username,
|
username=self.username,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_pil_format(self):
|
def test_pil_format(self):
|
||||||
'''
|
"""
|
||||||
Test pil format function
|
Test pil format function
|
||||||
'''
|
"""
|
||||||
self.assertEqual(pil_format('jpg'), 'JPEG')
|
self.assertEqual(pil_format("jpg"), "JPEG")
|
||||||
self.assertEqual(pil_format('jpeg'), 'JPEG')
|
self.assertEqual(pil_format("jpeg"), "JPEG")
|
||||||
self.assertEqual(pil_format('png'), 'PNG')
|
self.assertEqual(pil_format("png"), "PNG")
|
||||||
self.assertEqual(pil_format('gif'), 'GIF')
|
self.assertEqual(pil_format("gif"), "GIF")
|
||||||
self.assertEqual(pil_format('abc'), None)
|
self.assertEqual(pil_format("abc"), None)
|
||||||
|
|
||||||
def test_userprefs_str(self):
|
def test_userprefs_str(self):
|
||||||
'''
|
"""
|
||||||
Test if str representation of UserPreferences is as expected
|
Test if str representation of UserPreferences is as expected
|
||||||
'''
|
"""
|
||||||
up = UserPreference(theme='default', user=self.user)
|
up = UserPreference(theme="default", user=self.user)
|
||||||
print(up)
|
print(up)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user