예제 #1
0
 def test_connect(self):
     with TestAreaContext("server/socket") as work_area:
         work_area.copy_directory_content(self.config_path)
         pid = os.fork()
         if pid == 0:
             s = ErtSocket(self.config_file , self.port)
             s.listen( )
         else:
             time.sleep(0.50)
             
             self.sendRecv( ["ECHO" ,  "HEI"] , ["HEI"] )
             self.sendRecv( ["STATUS"] , ["OPEN"] )
             self.sendRecvRAW( "INVALID\n" , {"input" : "INVALID" , "ERROR" : "No JSON object could be decoded"})
             self.sendRecv( ["QUIT"] , ["QUIT"] )
예제 #2
0
 def startServer(self , config_file , port):
     self.pid = os.fork()
     if self.pid == 0:
         s = ErtSocket.connect(config_file , port , self.host , self.logger)
         s.listen( )
         os._exit(0) 
     else:
         time.sleep(0.50)
         return 
예제 #3
0
 def startServer(self, config_file, port):
     self.pid = os.fork()
     if self.pid == 0:
         s = ErtSocket.connect(config_file, port, self.host, self.logger)
         s.listen()
         os._exit(0)
     else:
         time.sleep(0.50)
         return
예제 #4
0
 def test_connect(self):
     with TestAreaContext("server/socket") as work_area:
         work_area.copy_directory_content(self.config_path)
         pid = os.fork()
         if pid == 0:
             s = ErtSocket.connect(self.config_file , self.port , self.host , self.logger)
             s.listen( )
         else:
             time.sleep(0.50)
             
             self.runCommand( ["STATUS"] , ["OPEN"] )
             self.runCommand( ["QUIT"] , ["QUIT"] )
         
             with self.assertRaises(Exception):
                 self.runCommand( "INVALID" )
                 
             with self.assertRaises(Exception):
                 self.runCommand( ["MISSING_COMMAND"] )