@@ -22,46 +22,6 @@ def setUp(self):
22
22
clever .api_base = os .environ .get ('CLEVER_API_BASE' , 'https://api.clever.com' )
23
23
if auth .get ("token" , None ):
24
24
clever .set_token (auth ["token" ])
25
- elif auth .get ("api_key" , None ):
26
- clever .set_api_key (auth ["api_key" ])
27
-
28
- def test_dns_failure (self ):
29
- api_base = clever .api_base
30
- try :
31
- clever .api_base = 'https://my-invalid-domain.ireallywontresolve/v1'
32
- self .assertRaises (clever .APIConnectionError , clever .District .all )
33
- finally :
34
- clever .api_base = api_base
35
-
36
- def test_list_accessors (self ):
37
- district = clever .District .all ()[0 ]
38
- self .assertEqual (district ['name' ], district .name )
39
-
40
- def test_starting_after (self ):
41
- allevents = clever .Event .all ()
42
- second_to_last_id = allevents [len (allevents )- 2 ]['id' ]
43
- events = clever .Event .iter (starting_after = second_to_last_id )
44
- count = len (list (events ))
45
- self .assertTrue (count == 1 )
46
-
47
- def test_ending_before (self ):
48
- allevents = clever .Event .all ()
49
- second_id = allevents [1 ]['id' ]
50
- events = clever .Event .iter (ending_before = second_id )
51
- count = len (list (events ))
52
- self .assertTrue (count == 1 )
53
-
54
- def test_unicode (self ):
55
- # Make sure unicode requests can be sent
56
- self .assertRaises (clever .APIError , clever .District .retrieve , id = u'☃' )
57
-
58
- def test_none_values (self ):
59
- district = clever .District .all (sort = None )[0 ]
60
- self .assertTrue (district .id )
61
-
62
- def test_missing_id (self ):
63
- district = clever .District ()
64
- self .assertRaises (clever .InvalidRequestError , district .refresh )
65
25
return FunctionalTests
66
26
67
27
@@ -92,17 +52,17 @@ def test_iter(self):
92
52
self .assertTrue (district .id )
93
53
94
54
def test_starting_after (self ):
95
- allevents = clever .Event .all ()
96
- second_to_last_id = allevents [len (allevents )- 2 ]['id' ]
97
- events = clever .Event .iter (starting_after = second_to_last_id )
98
- count = len (list (events ))
55
+ allstudents = clever .Student .all ()
56
+ second_to_last_id = allstudents [len (allstudents )- 2 ]['id' ]
57
+ students = clever .Student .iter (starting_after = second_to_last_id )
58
+ count = len (list (students ))
99
59
self .assertTrue (count == 1 )
100
60
101
61
def test_ending_before (self ):
102
- allevents = clever .Event .all ()
103
- second_id = allevents [1 ]['id' ]
104
- events = clever .Event .iter (ending_before = second_id )
105
- count = len (list (events ))
62
+ allstudents = clever .Student .all ()
63
+ second_id = allstudents [1 ]['id' ]
64
+ students = clever .Student .iter (ending_before = second_id )
65
+ count = len (list (students ))
106
66
self .assertTrue (count == 1 )
107
67
108
68
def test_iter_count (self ):
@@ -188,11 +148,9 @@ def test_rate_limiter(self):
188
148
if __name__ == '__main__' :
189
149
suite = unittest .TestSuite ()
190
150
for TestClass in [
191
- functional_test ({"api_key" : "DEMO_KEY" }),
192
151
functional_test ({"token" : "DEMO_TOKEN" }),
193
152
AuthenticationErrorTest ,
194
153
InvalidRequestErrorTest ,
195
154
TooManyRequestsErrorTest ]:
196
155
suite .addTest (unittest .TestLoader ().loadTestsFromTestCase (TestClass ))
197
156
unittest .TextTestRunner (verbosity = 2 ).run (suite )
198
-
0 commit comments