Private
Public Access
1
0

testing team-create

This commit is contained in:
Sander Roosendaal
2019-02-05 18:17:58 +01:00
parent 966b9e8ba1
commit ca6e7746b7
3 changed files with 38 additions and 8 deletions

View File

@@ -1310,9 +1310,38 @@ class PlannedSessionsView(TestCase):
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
url = '/sessions/teamcreate/'
url = '/rowers/sessions/teamcreate/'
response = self.c.get(url)
self.assertEqual(response.status_code,200)
form_data = {
'team':[1],
'startdate': self.w1.startdatetime.date(),
'enddate': (self.w1.startdatetime+datetime.timedelta(days=5)).date(),
'preferreddate': self.w1.startdatetime.date(),
'name': faker.word(),
'sessiontype': 'session',
'sessionmode': 'distance',
'criterium': 'none',
'sessionvalue': 13000,
'sessionunit': 'm',
'course': None,
'comment':faker.text()
}
plannedsessionform = PlannedSessionForm(form_data)
self.assertTrue(plannedsessionform.is_valid())
teamform = PlannedSessionTeamForm(self.u,form_data)
self.assertTrue(teamform.is_valid())
response = self.c.post(url,form_data,follow=True)
self.assertEqual(response.status_code,200)
def test_teamedit_view(self):
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)

View File

@@ -262,10 +262,11 @@ class URLTests(TestCase):
self.assertTrue(login)
response = self.c.get(url,follow=True)
if response.status_code != expected:
print url
print response.status_code
print(url )
print(response.status_code)
self.assertEqual(response.status_code,
expected)
expected)
html = BeautifulSoup(response.content,'html.parser')
urls = [a['href'] for a in html.find_all('a')]
@@ -274,10 +275,10 @@ class URLTests(TestCase):
if u not in tested and 'rowers' in u and 'http' not in u and 'authorize' not in u and 'import' not in u and 'logout' not in u:
response = self.c.get(u)
if response.status_code not in [200,302]:
print len(tested)
print url
print u
print response.status_code
print(len(tested))
print(url)
print(u)
print(response.status_code)
tested.append(u)
self.assertIn(response.status_code,
[200,302])

Binary file not shown.