Private
Public Access
1
0

2 more small tests

This commit is contained in:
Sander Roosendaal
2021-01-18 08:02:02 +01:00
parent 09aadd9ba1
commit f4f9b53be8

View File

@@ -110,12 +110,22 @@ class ChallengesTest(TestCase):
traces = getnearestraces(lat_lon,races)
self.assertEqual(len(traces),1)
lat_lon = (0, 0)
races = VirtualRace.objects.all()
traces = getnearestraces(lat_lon,races)
self.assertEqual(len(traces),1)
def test_getnearestcourses(self):
lat_lon = (52.214229145558484, 6.890036546847821)
courses = [self.ThyroBaantje]
tcourses = getnearestcourses(lat_lon,courses)
self.assertEqual(len(tcourses),1)
lat_lon = (0, 0)
courses = [self.ThyroBaantje]
tcourses = getnearestcourses(lat_lon,courses)
self.assertEqual(len(tcourses),1)
def test_courses_view(self):
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
@@ -405,6 +415,17 @@ class ChallengesTest(TestCase):
self.assertEqual(response.status_code, 200)
form_data = {
'teamname': 'ApeTeam',
'boattype': boattype,
'boatclass': boatclass,
'weightcategory': weightclass,
'adaptiveclass': adaptiveclass,
'age': age,
'mix': False,
'acceptsocialmedia': True,
'entrycategory':initialcategory.id,
}
# register again
url = reverse('virtualevent_register_view',kwargs={'id':race.id})
@@ -483,8 +504,13 @@ class ChallengesTest(TestCase):
# add follower
url = reverse('addfollower_view',kwargs={'id':race.id})
response = self.c.get(url)
self.assertEqual(response.status_code,200)
response = self.c.get(url,follow=True)
expected_url = reverse('virtualevent_view',kwargs={'id':race.id})
self.assertRedirects(response, expected_url=expected_url,
status_code=302,target_status_code=200)
self.assertEqual(response.status_code, 200)
# add boat