Exemplo n.º 1
0
 def test_get_json_1(self):
     retJson=get_json(self.goodjsonurl)
     retJson2=get_json(self.goodjsonurlunsorted)
     self.assertEqual(
         json.dumps(retJson,sort_keys=True),
         json.dumps(retJson2,sort_keys=True),
         'json not equal')
Exemplo n.º 2
0
 def test_params(self):
     url = 'https://api.twitch.tv/kraken/streams'
     limit = 10
     r = get_json(url, parameters={'limit': limit})
     self.assertEqual(len(r.get('streams')), limit)
Exemplo n.º 3
0
 def test_get_json_fail_3(self):
     with self.assertRaises(ValueError):
         get_json(self.goodurl)
Exemplo n.º 4
0
 def test_get_json_fail_2(self):
     with self.assertRaises(ValueError):
         get_json(self.badurl2)
Exemplo n.º 5
0
 def test_params(self):
     url = 'https://api.twitch.tv/kraken/streams'
     limit = 10
     r = get_json(url, parameters={'limit': limit})
     self.assertEqual(len(r.get('streams')), limit)
Exemplo n.º 6
0
 def test_get_json_1(self):
     retJson = get_json(self.goodjsonurl)
     retJson2 = get_json(self.goodjsonurlunsorted)
     self.assertEqual(json.dumps(retJson, sort_keys=True),
                      json.dumps(retJson2, sort_keys=True),
                      'json not equal')
Exemplo n.º 7
0
 def test_get_json_fail_3(self):
     with self.assertRaises(ValueError):
         get_json(self.goodurl)
Exemplo n.º 8
0
 def test_get_json_fail_2(self):
     with self.assertRaises(ValueError):
         get_json(self.badurl2)