Example #1
0
 def setUp(self):
     self.token=newAPI().login_token()
     self.data = newAPI().get_list()
     self.randomnum = random.randint(0, len(self.data)-1)
     self.randomdata = self.data[self.randomnum]
     self.postdata = {
         'channelId': self.randomdata['channelId'],
         'platformId': self.randomdata['platformId'],
         'version': self.randomdata['configVersion'],
         'token': self.token
     }
Example #2
0
 def test_empty_param(self):
     param=['channelId','platformId','version']
     param_nu=random.randint(0,len(param)-1)
     self.postdata[param[param_nu]]=" "
     res = requests.post(url=newAPI().conf['get_channel_packfile_url'], data=self.postdata)
     code = json.loads(res.text)['code']
     self.assertEqual(str(code), '1')
Example #3
0
 def test_error_platformId(self):
     self.postdata['platformId'] = len(self.data)+55
     res = requests.post(url=newAPI().conf['get_channel_packfile_url'], data=self.postdata)
     code = json.loads(res.text)['code']
     self.assertEqual(str(code), '1')
Example #4
0
 def test_error_version(self):
     self.postdata['version'] = "3.0.20"
     res = requests.post(url=newAPI().conf['get_channel_packfile_url'], data=self.postdata)
     code = json.loads(res.text)['code']
     self.assertEqual(str(code), '1')
Example #5
0
 def test_token_error(self):
     self.postdata['token']="123"
     res = requests.post(url=newAPI().conf['get_channel_packfile_url'], data=self.postdata)
     #code = json.loads(res.text)['code']
     self.assertEqual(str(res.status_code), '403')
Example #6
0
 def test_nomral(self):
     res=requests.post(url=newAPI().conf['get_channel_packfile_url'],data=self.postdata)
     code = json.loads(res.text)['code']
     self.assertEqual(str(code), '0')
 def setUp(self):
     self.token = {
         'token': newAPI().login_token()
     }
 def test_empty(self):
     self.token['token']=" "
     res=requests.post(url=newAPI().conf['get_common_packfile_url'],data=self.token)
     self.assertEqual(str(res.status_code),'403')
 def test_normal(self):
     res=requests.post(url=newAPI().conf['get_common_packfile_url'],data=self.token)
     code=json.loads(res.text)['code']
     self.assertEqual(str(code),'0')