-
Notifications
You must be signed in to change notification settings - Fork 8
/
coaches_tests.py
30 lines (23 loc) · 959 Bytes
/
coaches_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import unittest
from power_of_10 import coaches, exceptions
class FindCoaches(unittest.TestCase):
def test_firstname(self):
coach = coaches.search_coaches(firstname='John')
self.assertEqual(len(coach), 225)
def test_surname(self):
coach = coaches.search_coaches(surname='smith')
self.assertEqual(len(coach), 95)
def test_club(self):
coach = coaches.search_coaches(club='sutton')
self.assertEqual(len(coach), 41)
def test_specific_person(self):
coach = coaches.search_coaches(firstname='alex', surname='abbott', club='sutton')
self.assertEqual(coach, '380620')
def test_no_search(self):
with self.assertRaises(exceptions.QueryError):
coaches.search_coaches()
def test_non_exisiting_athlete(self):
with self.assertRaises(exceptions.QueryError):
coaches.search_coaches('ouoiubui')
if __name__ == '__main__':
unittest.main()