PEP8 in gestion/tests.py

This commit is contained in:
Martin Pépin 2017-02-12 14:18:51 +01:00
parent a28c00e474
commit 8b620a5319

View file

@ -18,9 +18,9 @@ def create_profile(username):
In order to create a profile, I need to create a User first. In order to create a profile, I need to create a User first.
This is annoying in most situations, as I just want a profile. This is annoying in most situations, as I just want a profile.
""" """
u = User.objects.create(username=username, User.objects.create(username=username,
first_name=username.title(), first_name=username.title(),
last_name=username.title()) last_name=username.title())
p, = Profile.objects.filter(user__username=username) p, = Profile.objects.filter(user__username=username)
return p return p
@ -55,9 +55,9 @@ class SimpleTest(TestCase):
# each profile is linked to at most one account of the same type. # each profile is linked to at most one account of the same type.
p1 = create_profile('bar') p1 = create_profile('bar')
p2 = create_profile('baz') p2 = create_profile('baz')
pkfet1 = Account.objects.create(profile=p1, trigramme='BAR') Account.objects.create(profile=p1, trigramme='BAR')
pcof2 = CofProfile.objects.create(profile=p2) CofProfile.objects.create(profile=p2)
pkfet2 = Account.objects.create(profile=p2, trigramme='BAZ') Account.objects.create(profile=p2, trigramme='BAZ')
self.assertRaises(IntegrityError, self.assertRaises(IntegrityError,
CofProfile.objects.create, profile=p2) CofProfile.objects.create, profile=p2)
@ -65,7 +65,7 @@ class SimpleTest(TestCase):
class TestProfile(TestCase): class TestProfile(TestCase):
@patch('kfet.signals.messages') @patch('kfet.signals.messages')
def test_profile(self, mock_messages): def test_profile(self, mock_messages):
root = User.objects.create_superuser('root', 'foo@bar.com', 'root') User.objects.create_superuser('root', 'foo@bar.com', 'root')
c = Client() c = Client()
c.login(username='root', password='root') c.login(username='root', password='root')
response = c.get('/') response = c.get('/')