cof.tests -- Address flake8 concerns

This commit is contained in:
Aurélien Delobelle 2018-09-30 12:56:58 +02:00
parent 44e5387f15
commit 064c23902b

View file

@ -165,9 +165,9 @@ class RegistrationViewTests(ViewTestCaseMixin, TestCase):
o2 = e.options.create(name='Option 2', multi_choices=True)
oc1 = o1.choices.create(value='O1 - Choice 1')
oc2 = o1.choices.create(value='O1 - Choice 2')
o1.choices.create(value='O1 - Choice 2')
oc3 = o2.choices.create(value='O2 - Choice 1')
oc4 = o2.choices.create(value='O2 - Choice 2')
o2.choices.create(value='O2 - Choice 2')
self.client.post(self.url, dict(self._minimal_data, **{
'username': 'user',
@ -220,10 +220,10 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
def test_empty(self):
r = self.client.get(self.t_urls[0])
user_form = r.context['user_form']
profile_form = r.context['profile_form']
events_form = r.context['event_formset']
clubs_form = r.context['clubs_form']
self.assertIn('user_form', r.context)
self.assertIn('profile_form', r.context)
self.assertIn('event_formset', r.context)
self.assertIn('clubs_form', r.context)
def test_username(self):
u = self.users['user']
@ -233,11 +233,11 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
r = self.client.get(self.t_urls[1])
self.assertIn('user_form', r.context)
self.assertIn('profile_form', r.context)
self.assertIn('event_formset', r.context)
self.assertIn('clubs_form', r.context)
user_form = r.context['user_form']
profile_form = r.context['profile_form']
events_form = r.context['event_formset']
clubs_form = r.context['clubs_form']
self.assertEqual(user_form['username'].initial, 'user')
self.assertEqual(user_form['first_name'].initial, 'first')
self.assertEqual(user_form['last_name'].initial, 'last')
@ -245,11 +245,12 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
def test_clipper(self):
r = self.client.get(self.t_urls[2])
self.assertIn('user_form', r.context)
self.assertIn('profile_form', r.context)
self.assertIn('event_formset', r.context)
self.assertIn('clubs_form', r.context)
user_form = r.context['user_form']
profile_form = r.context['profile_form']
events_form = r.context['event_formset']
clubs_form = r.context['clubs_form']
self.assertEqual(user_form['first_name'].initial, 'First')
self.assertEqual(user_form['last_name'].initial, 'Last1 Last2')
self.assertEqual(user_form['email'].initial, 'uid@clipper.ens.fr')
@ -782,9 +783,10 @@ class CalendarViewTests(ViewTestCaseMixin, TestCase):
fermeture=self.now,
active=True,
)
l = Salle.objects.create()
location = Salle.objects.create()
s = t.spectacle_set.create(
date=self.now, price=3.5, slots=20, location=l, listing=True)
date=self.now, price=3.5, slots=20, location=location,
listing=True)
r = self.client.post(self.url, {'other_shows': [str(s.pk)]})
@ -815,17 +817,17 @@ class CalendarICSViewTests(ViewTestCaseMixin, TestCase):
fermeture=self.now,
active=True,
)
l = Salle.objects.create(name='Location')
location = Salle.objects.create(name='Location')
self.s1 = self.t.spectacle_set.create(
price=1, slots=10, location=l, listing=True,
price=1, slots=10, location=location, listing=True,
title='Spectacle 1', date=self.now + timedelta(days=1),
)
self.s2 = self.t.spectacle_set.create(
price=2, slots=20, location=l, listing=True,
price=2, slots=20, location=location, listing=True,
title='Spectacle 2', date=self.now + timedelta(days=2),
)
self.s3 = self.t.spectacle_set.create(
price=3, slots=30, location=l, listing=True,
price=3, slots=30, location=location, listing=True,
title='Spectacle 3', date=self.now + timedelta(days=3),
)