Rework with black

This commit is contained in:
Oliver Falk
2022-02-11 13:23:32 +01:00
parent 337ced827a
commit fa4f5da45d

View File

@@ -1,6 +1,7 @@
''' # -*- coding: utf-8 -*-
"""
Test our views in ivatar.ivataraccount.views and ivatar.views Test our views in ivatar.ivataraccount.views and ivatar.views
''' """
# pylint: disable=too-many-lines # pylint: disable=too-many-lines
import os import os
import django import django
@@ -10,33 +11,34 @@ from django.contrib.auth.models import User
from ivatar.utils import random_string from ivatar.utils import random_string
os.environ['DJANGO_SETTINGS_MODULE'] = 'ivatar.settings' os.environ["DJANGO_SETTINGS_MODULE"] = "ivatar.settings"
django.setup() django.setup()
class Tester(TestCase): # pylint: disable=too-many-public-methods class Tester(TestCase): # pylint: disable=too-many-public-methods
''' """
Main test class Main test class
''' """
client = Client() client = Client()
user = None user = None
username = random_string() username = random_string()
password = random_string() password = random_string()
email = '%s@%s.%s' % (username, random_string(), random_string(2)) email = "%s@%s.%s" % (username, random_string(), random_string(2))
# Dunno why random tld doesn't work, but I'm too lazy now to investigate # Dunno why random tld doesn't work, but I'm too lazy now to investigate
openid = 'http://%s.%s.%s/' % (username, random_string(), 'org') openid = "http://%s.%s.%s/" % (username, random_string(), "org")
def login(self): def login(self):
''' """
Login as user Login as user
''' """
self.client.login(username=self.username, password=self.password) self.client.login(username=self.username, password=self.password)
def setUp(self): def setUp(self):
''' """
Prepare for tests. Prepare for tests.
- Create user - Create user
''' """
self.user = User.objects.create_user( self.user = User.objects.create_user(
username=self.username, username=self.username,
password=self.password, password=self.password,
@@ -46,8 +48,9 @@ class Tester(TestCase): # pylint: disable=too-many-public-methods
""" """
Test incorrect digest Test incorrect digest
""" """
response = self.client.get('/avatar/%s' % 'x'*65, follow=True) response = self.client.get("/avatar/%s" % "x" * 65, follow=True)
self.assertRedirects( self.assertRedirects(
response=response, response=response,
expected_url='/static/img/deadbeef.png', expected_url="/static/img/deadbeef.png",
msg_prefix='Why does an invalid hash not redirect to deadbeef?') msg_prefix="Why does an invalid hash not redirect to deadbeef?",
)