def testpost(self): lib = PycURLLibrary() messageFile = join(testenv.ROOT_DIR, 'soap-request.xml') print messageFile f = open(messageFile, 'r') data = f.read() f.close() lib.verbose() lib.set_url('http://localhost:53004/soap') lib.post_fields(data) lib.perform() response = lib.response() if response is None: raise NotImplementedError print 'POST Response:' print response responseHeader = lib.response_headers() print 'POST Response Headers:' print responseHeader responseStatus = lib.http_response_status() print 'HTTP Response Status:' print responseStatus lib.response_status_should_contain(unicode('200')) root = lib.parse_xml() print root root = lib.xml_root_element() print root elems = lib.find_elements(root, unicode('country')) print elems if not elems: print 'country empty' elems = lib.find_elements( root, unicode('.//{http://ws.poc.jivalo/hello/v1}customer')) if not elems: print 'customer empty' print elems for el in elems: print el.tag elems = lib.find_elements(root, unicode('.//name')) lib.should_contain_element(root, unicode('.//name')) print elems for el in elems: print el.tag print el.text lib.element_should_contain(elems[0], unicode('Hello, world!')) elem = lib.find_first_element(root, unicode('.//name')) print elem try: lib.element_should_contain(elems[0], 'Hello') except AssertionError, a: print a
def testpost(self): lib = PycURLLibrary(); messageFile = join(testenv.ROOT_DIR, 'soap-request.xml') print messageFile f = open(messageFile, 'r') data = f.read() f.close() lib.verbose() lib.set_url('http://localhost:53004/soap') lib.post_fields(data) lib.perform() response = lib.response() if response is None: raise NotImplementedError print 'POST Response:' print response responseHeader = lib.response_headers() print 'POST Response Headers:' print responseHeader responseStatus = lib.http_response_status() print 'HTTP Response Status:' print responseStatus lib.response_status_should_contain(unicode('200')) root = lib.parse_xml() print root root = lib.xml_root_element() print root elems = lib.find_elements(root, unicode('country')) print elems if not elems: print 'country empty' elems = lib.find_elements(root, unicode('.//{http://ws.poc.jivalo/hello/v1}customer')) if not elems: print 'customer empty' print elems for el in elems: print el.tag elems = lib.find_elements(root, unicode('.//name')) lib.should_contain_element(root, unicode('.//name')) print elems for el in elems: print el.tag print el.text lib.element_should_contain(elems[0], unicode('Hello, world!')) elem = lib.find_first_element(root, unicode('.//name')) print elem try: lib.element_should_contain(elems[0], 'Hello') except AssertionError, a: print a
def testgetHeaderFile(self): lib = PycURLLibrary() lib.verbose() headerFile = join(testenv.ROOT_DIR, 'headers-file.txt') lib.headers_file(headerFile) lib.set_url('http://localhost:53004/rest') lib.perform() response = lib.response() if response is None: raise NotImplementedError print('GET Response:') print(response) responseHeader = lib.response_headers() print('GET Response Headers:') print(responseHeader) pass
def testget(self): lib = PycURLLibrary() lib.verbose() lib.add_header('Content-Type: text/xml; charset=UTF-8') lib.add_header('Version: 1') lib.set_url('http://localhost:53004/rest') lib.perform() response = lib.response() if response is None: raise NotImplementedError print('GET Response:') print(response) responseHeader = lib.response_headers() print('GET Response Headers:') print(responseHeader) pass
def testgetHeaderFile(self): lib = PycURLLibrary(); lib.verbose() headerFile = join(testenv.ROOT_DIR, 'headers-file.txt') lib.headers_file(headerFile) lib.set_url('http://localhost:53004/rest') lib.perform() response = lib.response() if response is None: raise NotImplementedError print 'GET Response:' print response responseHeader = lib.response_headers() print 'GET Response Headers:' print responseHeader pass
def testget(self): lib = PycURLLibrary(); lib.verbose() lib.add_header('Content-Type: text/xml; charset=UTF-8') lib.add_header('Version: 1') lib.set_url('http://localhost:53004/rest') lib.perform() response = lib.response() if response is None: raise NotImplementedError print 'GET Response:' print response responseHeader = lib.response_headers() print 'GET Response Headers:' print responseHeader pass