def setUp(self): self.host = "www.harshniketseta.local" self.path = "testpath" self.base = BaseService("http://"+urljoin(self.host, self.path)) self.rest = Rest(self.host, self.path) self.xmlrpc = XMLRPC(self.host, self.path)
class inittest(unittest.TestCase): def setUp(self): self.host = "www.harshniketseta.local" self.path = "testpath" self.base = BaseService("http://"+urljoin(self.host, self.path)) self.rest = Rest(self.host, self.path) self.xmlrpc = XMLRPC(self.host, self.path) def testrestinit(self): self.assertEqual(self.base.getURL(), self.rest.getURL()) def testXMLRPCinit(self): self.assertEqual(self.base.getURL(), self.xmlrpc.getURL())
''' Created on 27-Jun-2012 @author: harsh ''' from services import Rest, XMLRPC from utils import Auth import pprint host="preview.ignitelabs.local" rest_path="restapi" rest = Rest(host=host, path=rest_path, username="******", password="******", auth=Auth.SESSION) Nodes = rest.retrieve_node(nid=100) Nodes = Nodes.data pprint.pprint(Nodes) xmlrpc_path="xmlrpc" xmlrpc = XMLRPC(host=host, path=xmlrpc_path) xmlrpc.login(username="******", password="******", auth=Auth.SESSION) #rest.connect() #rest.login()