Beispiel #1
0
 def test_get_Statistic(self):
     user = UserAPI(self.baseurl)
     response = user.user_Statistic(self.data[0]['id'])
     try:
         self.assertEqual(200, response.status_code,
                          'status code:%s' % response.status_code)
         r = response.json()
         # self.api.writeLog(sys._getframe().f_code.co_name, response.text)
         self.assertEqual(0, r['status'])
     except:
         print 'url: %s\n' % response.url
         print u'状态码: %s' % response.status_code
         print u'传递的参数是: %s\n' % self.data[0]['id']
         print u'响应内容: %s\n' % response.text
         raise
     finally:
         self.api.writeLog(
             sys._getframe().f_code.co_name,
             'api: %s\nstatus_code: %s\ntext: %s' %
             (response.url, response.status_code, response.text))
Beispiel #2
0
 def test_Statistic_id_null(self):
     user = UserAPI(self.baseurl)
     response = user.user_Statistic(None)
     r = response.json()
     self.api.writeLog(sys._getframe().f_code.co_name, response.text)
     self.assertEqual(999, r['status'])
Beispiel #3
0
 def test_Statistic_id_wrong(self):
     user = UserAPI(self.baseurl)
     response = user.user_Statistic("110001779")
     r = response.json()
     self.api.writeLog(sys._getframe().f_code.co_name, response.text)
     self.assertEqual(98, r['status'])