Verified Commit 9a40beda authored by Oliver Falk's avatar Oliver Falk
Browse files

Add aux tests

parent f924a8e9
Pipeline #2038 passed with stage
in 11 minutes and 3 seconds
'''
Test various other parts of ivatar/libravatar in order
to increase the overall test coverage. Test in here, didn't
fit anywhere else.
'''
from django.test import TestCase
from django.contrib.auth.models import User
from ivatar.utils import random_string
from ivatar.ivataraccount.models import pil_format, UserPreference
class Tester(TestCase):
'''
Main test class
'''
user = None
username = random_string()
def setUp(self):
'''
Prepare tests.
- Create user
'''
self.user = User.objects.create_user(
username=self.username,
)
def test_pil_format(self):
'''
Test pil format function
'''
self.assertEqual(pil_format('jpg'), 'JPEG')
self.assertEqual(pil_format('jpeg'), 'JPEG')
self.assertEqual(pil_format('png'), 'PNG')
self.assertEqual(pil_format('gif'), 'GIF')
self.assertEqual(pil_format('abc'), None)
def test_userprefs_str(self):
'''
Test if str representation of UserPreferences is as expected
'''
up = UserPreference(theme='default', user=self.user)
print(up)
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