File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import os
4
+ import sys
5
+ import unittest
6
+ sys .path .insert (0 , os .path .join (os .path .dirname (__file__ ), '..' ))
7
+ import clever
8
+ from clever import importer
9
+
10
+ class CleverTestCase (unittest .TestCase ):
11
+ def setUp (self ):
12
+ super (CleverTestCase , self ).setUp ()
13
+ clever .set_api_key ('DEMO_KEY' )
14
+
15
+ class CertPinning (CleverTestCase ):
16
+
17
+ def test_prod_api (self ):
18
+ clever .api_base = 'https://api.clever.com'
19
+ district = clever .District .all ()[0 ]
20
+ self .assertEqual (district .name , 'Demo District' )
21
+
22
+ def test_staging_api (self ):
23
+ clever .api_base = 'https://api-staging.ops.clever.com'
24
+ district = clever .District .all ()[0 ]
25
+ self .assertEqual (district .name , 'Demo District' )
26
+
27
+ def test_cert_failure (self ):
28
+ try :
29
+ clever .api_base = 'https://httpbin.org'
30
+ self .assertRaises (clever .APIConnectionError , clever .District .all ())
31
+ finally :
32
+ print 'a'
33
+
34
+
35
+ if __name__ == '__main__' :
36
+ suite = unittest .TestSuite ()
37
+ suite .addTest (unittest .TestLoader ().loadTestsFromTestCase (CertPinning ))
38
+ unittest .TextTestRunner (verbosity = 3 ).run (suite )
You can’t perform that action at this time.
0 commit comments