forked from DGNum/gestioCOF
cof.tests -- Address flake8 concerns
This commit is contained in:
parent
44e5387f15
commit
064c23902b
1 changed files with 21 additions and 19 deletions
|
@ -165,9 +165,9 @@ class RegistrationViewTests(ViewTestCaseMixin, TestCase):
|
||||||
o2 = e.options.create(name='Option 2', multi_choices=True)
|
o2 = e.options.create(name='Option 2', multi_choices=True)
|
||||||
|
|
||||||
oc1 = o1.choices.create(value='O1 - Choice 1')
|
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')
|
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, **{
|
self.client.post(self.url, dict(self._minimal_data, **{
|
||||||
'username': 'user',
|
'username': 'user',
|
||||||
|
@ -220,10 +220,10 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
r = self.client.get(self.t_urls[0])
|
r = self.client.get(self.t_urls[0])
|
||||||
|
|
||||||
user_form = r.context['user_form']
|
self.assertIn('user_form', r.context)
|
||||||
profile_form = r.context['profile_form']
|
self.assertIn('profile_form', r.context)
|
||||||
events_form = r.context['event_formset']
|
self.assertIn('event_formset', r.context)
|
||||||
clubs_form = r.context['clubs_form']
|
self.assertIn('clubs_form', r.context)
|
||||||
|
|
||||||
def test_username(self):
|
def test_username(self):
|
||||||
u = self.users['user']
|
u = self.users['user']
|
||||||
|
@ -233,11 +233,11 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
|
||||||
|
|
||||||
r = self.client.get(self.t_urls[1])
|
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']
|
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['username'].initial, 'user')
|
||||||
self.assertEqual(user_form['first_name'].initial, 'first')
|
self.assertEqual(user_form['first_name'].initial, 'first')
|
||||||
self.assertEqual(user_form['last_name'].initial, 'last')
|
self.assertEqual(user_form['last_name'].initial, 'last')
|
||||||
|
@ -245,11 +245,12 @@ class RegistrationFormViewTests(ViewTestCaseMixin, TestCase):
|
||||||
def test_clipper(self):
|
def test_clipper(self):
|
||||||
r = self.client.get(self.t_urls[2])
|
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']
|
user_form = r.context['user_form']
|
||||||
profile_form = r.context['profile_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['first_name'].initial, 'First')
|
||||||
self.assertEqual(user_form['last_name'].initial, 'Last1 Last2')
|
self.assertEqual(user_form['last_name'].initial, 'Last1 Last2')
|
||||||
self.assertEqual(user_form['email'].initial, 'uid@clipper.ens.fr')
|
self.assertEqual(user_form['email'].initial, 'uid@clipper.ens.fr')
|
||||||
|
@ -782,9 +783,10 @@ class CalendarViewTests(ViewTestCaseMixin, TestCase):
|
||||||
fermeture=self.now,
|
fermeture=self.now,
|
||||||
active=True,
|
active=True,
|
||||||
)
|
)
|
||||||
l = Salle.objects.create()
|
location = Salle.objects.create()
|
||||||
s = t.spectacle_set.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)]})
|
r = self.client.post(self.url, {'other_shows': [str(s.pk)]})
|
||||||
|
|
||||||
|
@ -815,17 +817,17 @@ class CalendarICSViewTests(ViewTestCaseMixin, TestCase):
|
||||||
fermeture=self.now,
|
fermeture=self.now,
|
||||||
active=True,
|
active=True,
|
||||||
)
|
)
|
||||||
l = Salle.objects.create(name='Location')
|
location = Salle.objects.create(name='Location')
|
||||||
self.s1 = self.t.spectacle_set.create(
|
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),
|
title='Spectacle 1', date=self.now + timedelta(days=1),
|
||||||
)
|
)
|
||||||
self.s2 = self.t.spectacle_set.create(
|
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),
|
title='Spectacle 2', date=self.now + timedelta(days=2),
|
||||||
)
|
)
|
||||||
self.s3 = self.t.spectacle_set.create(
|
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),
|
title='Spectacle 3', date=self.now + timedelta(days=3),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue