def get_url(endpoint): host = Config.url() url = host + endpoint return url
def test_post_params(self, result): #上传一个文件判断是否上传成功 os.chdir(Config.uploadpath()) print(os.getcwd) md5code = base.getfilemd5('1.pdf') headers = {'nb-file-md5': md5code} files = {'field1': ('1.pdf', open('1.pdf', 'rb'))} DataAll = {'headers': headers, 'files': files} r = HttpService.MyHTTP(self.url).post(self.url, **DataAll) #roo = requests.post(self.url,headers = headers,files = files) #r = roo.json() print(r) connect = r.get('Success') msg = r.get("Message") print(connect) self.assertEqual(connect, result) self.assertEqual(msg, "上传成功")
def get_url(doc): host = Config.url() doc = doc url = ''.join([host,doc]) return url
def get_mock_status(): mock_status = Config.mock_open() return mock_status
def get_url(EndPoint): host = Config.url() endpoint = EndPoint url = ''.join([host, endpoint]) return url
def __init__(self): self.url = Config.url()
def __init__(self):#构造方法,初始化对象 self.url = Config.url()
def get_url(EndPoint): # 用例中定义的endpoint都不一样,写在这里,怎么修改都不会影响用例,用例只要把传递参数过来 host = Config.url() endpoint = EndPoint url = ''.join([host, endpoint]) return url