testing team-create
This commit is contained in:
@@ -1310,9 +1310,38 @@ class PlannedSessionsView(TestCase):
|
|||||||
login = self.c.login(username=self.u.username, password=self.password)
|
login = self.c.login(username=self.u.username, password=self.password)
|
||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
url = '/sessions/teamcreate/'
|
url = '/rowers/sessions/teamcreate/'
|
||||||
response = self.c.get(url)
|
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):
|
def test_teamedit_view(self):
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
login = self.c.login(username=self.u.username, password=self.password)
|
||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|||||||
@@ -262,10 +262,11 @@ class URLTests(TestCase):
|
|||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
response = self.c.get(url,follow=True)
|
response = self.c.get(url,follow=True)
|
||||||
if response.status_code != expected:
|
if response.status_code != expected:
|
||||||
print url
|
print(url )
|
||||||
print response.status_code
|
print(response.status_code)
|
||||||
|
|
||||||
self.assertEqual(response.status_code,
|
self.assertEqual(response.status_code,
|
||||||
expected)
|
expected)
|
||||||
|
|
||||||
html = BeautifulSoup(response.content,'html.parser')
|
html = BeautifulSoup(response.content,'html.parser')
|
||||||
urls = [a['href'] for a in html.find_all('a')]
|
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:
|
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)
|
response = self.c.get(u)
|
||||||
if response.status_code not in [200,302]:
|
if response.status_code not in [200,302]:
|
||||||
print len(tested)
|
print(len(tested))
|
||||||
print url
|
print(url)
|
||||||
print u
|
print(u)
|
||||||
print response.status_code
|
print(response.status_code)
|
||||||
tested.append(u)
|
tested.append(u)
|
||||||
self.assertIn(response.status_code,
|
self.assertIn(response.status_code,
|
||||||
[200,302])
|
[200,302])
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user