Пример #1
0
 def test_json_parser(self):
     main_class = MainClass('http://jsonplaceholder.typicode.com/users')
     response = main_class._get_json_data()
     parsed = main_class._parse_json(response)
     for row in parsed:
         self.assertIs(type(row['id']), int)
Пример #2
0
 def test_incorrect_json_parser(self):
     main_class = MainClass('http://pawka.ru')
     response = main_class._get_json_data()
     self.assertRaises(Exception, main_class._parse_json, response)
Пример #3
0
 def test_incorrect_url(self):
     main_class = MainClass('http://jsonplaceholder.typicode.com/users3')
     response = main_class._get_json_data()
     self.assertEqual(response.status_code, 404)