Esempio n. 1
0
 def test_createFileReq(self):
     json_str = mock_msg_as_json(
         'createFileReq', {
             'ssh': self.ssh,
             'file': {
                 'hostName': 'localhost',
                 'path': tempfile.gettempdir(),
                 'name': 'foobar'
             },
             'contentString': 'a=0\nb=1\n',
             'contents': {
                 'params': {
                     'sep': None,
                     'para': [{
                         'name': None,
                         'sep': None,
                         'val': None
                     }]
                 }
             }
         })
     print json_str
     try:
         print request_handler.handle_req(json.loads(json_str))
     finally:
         try:
             os.remove(os.path.join(tempfile.gettempdir(), 'foobar'))
         except:
             pass
Esempio n. 2
0
 def test_hostInfoReq(self):
     json_str = mock_msg_as_json('hostInfoReq', {
         'ssh': self.ssh,
         'hostName': 'localhost'
     })
     print 'hostInfoReq: ' + json_str
     print request_handler.handle_req(json.loads(json_str))
Esempio n. 3
0
    def test_createFileReq(self):
        json_str = mock_msg_as_json('createFileReq', 
          {'ssh': self.ssh, 'file': {'hostName': 'localhost', 'path': tempfile.gettempdir(), 'name': 'foobar'}, 
           'contentString': 'a=0\nb=1\n', 'contents': {'params': {'sep': None, 'para': [{'name': None, 'sep': None, 'val': None}]}}})
        print json_str
	try:
          print request_handler.handle_req(json.loads(json_str))
	finally:
          try:
            os.remove(os.path.join(tempfile.gettempdir(),'foobar'))
          except:
            pass
Esempio n. 4
0
 def test_hostInfoReq(self):
     json_str = mock_msg_as_json('hostInfoReq', {'ssh': self.ssh,
                                 'hostName': 'localhost'})
     print 'hostInfoReq: '+json_str
     print request_handler.handle_req(json.loads(json_str))