Exemplo n.º 1
0
    def testSimulations(self):
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(self.config_path)

            
            ert_server = ErtServer(self.config_file)
            cmd = ["INIT_SIMULATIONS"]
            with self.assertRaises(ErtCmdError):
                res = ert_server.evalCmd( cmd )
                
            cmd = ["INIT_SIMULATIONS" , 100 , "Init_case"]
            res = ert_server.evalCmd( cmd )

            cmd = ["STATUS"]
            res = ert_server.evalCmd( cmd )
            self.assertEqual( res , ["RUNNING" , 0 , 0 ])
            
            cmd = ["START_SIMULATION" , "0"]
Exemplo n.º 2
0
    def testSimulations(self):
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(self.config_path)

            ert_server = ErtServer(self.config_file, self.logger)
            cmd = ["INIT_SIMULATIONS"]
            with self.assertRaises(IndexError):
                res = ert_server.evalCmd(cmd)

            cmd = ["UNKNOWN_COMMAND"]
            with self.assertRaises(KeyError):
                res = ert_server.evalCmd(cmd)

            cmd = ["GET_RESULT"]  # Missing arguments
            with self.assertRaises(IndexError):
                res = ert_server.evalCmd(cmd)

            cmd = ["GET_RESULT", 1, 1, "KW"]  #Missing keyword
            with self.assertRaises(KeyError):
                res = ert_server.evalCmd(cmd)
Exemplo n.º 3
0
    def testSimulations(self):
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(self.config_path)

            ert_server = ErtServer(self.config_file, self.logger)
            cmd = ["INIT_SIMULATIONS"]
            with self.assertRaises(IndexError):
                res = ert_server.evalCmd(cmd)

            cmd = ["UNKNOWN_COMMAND"]
            with self.assertRaises(KeyError):
                res = ert_server.evalCmd(cmd)

            cmd = ["GET_RESULT"]  # Missing arguments
            with self.assertRaises(IndexError):
                res = ert_server.evalCmd(cmd)

            cmd = ["GET_RESULT", 1, 1, "KW"]  # Missing keyword
            with self.assertRaises(KeyError):
                res = ert_server.evalCmd(cmd)
Exemplo n.º 4
0
    def testTIMESTEP(self):
        config_path = self.createTestPath("Statoil/config/with_data")
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(config_path)

            ert_server = ErtServer(self.config_file, self.logger)
            cmd = ["TIME_STEP"]

            res = ert_server.evalCmd(cmd)

            data = json.dumps(res)

            result = json.loads(data)
            self.assertEqual(res[0], "OK")
Exemplo n.º 5
0
    def testCreate(self):
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(self.config_path)

            with self.assertRaises(IOError):
                ert_server = ErtServer("Does/not/exist", self.logger)

            ert_server = ErtServer(self.config_file, self.logger)
            self.assertTrue(ert_server.isConnected())
            with self.assertRaises(KeyError):
                res = ert_server.evalCmd(["UNKNWON-COMMAND"])

            ert_server.close()
            self.assertTrue(not ert_server.isConnected())
Exemplo n.º 6
0
    def testCreate(self):
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(self.config_path)

            with self.assertRaises(IOError):
                ert_server = ErtServer( "Does/not/exist" , self.logger)
                
            ert_server = ErtServer(self.config_file , self.logger)
            self.assertTrue( ert_server.isConnected() )
            with self.assertRaises(KeyError):
                res = ert_server.evalCmd( ["UNKNWON-COMMAND"])

            ert_server.close()
            self.assertTrue( not ert_server.isConnected() )
Exemplo n.º 7
0
    def testTIMESTEP(self):
        config_path = self.createTestPath("Statoil/config/with_data")
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(config_path)

            ert_server = ErtServer(self.config_file, self.logger)
            cmd = ["TIME_STEP"]

            res = ert_server.evalCmd(cmd)

            data = json.dumps(res)

            result = json.loads(data)
            self.assertEqual(res[0], "OK")
Exemplo n.º 8
0
    def testCreate(self):
        with TestAreaContext("server/server") as work_area:
            work_area.copy_directory_content(self.config_path)

            with self.assertRaises(IOError):
                ert_server = ErtServer( "Does/not/exist" )
                
            ert_server = ErtServer(self.config_file)
            self.assertTrue( ert_server.isConnected() )
            ert_server.close()
            self.assertTrue( not ert_server.isConnected() )
            
            ert_server = ErtServer()
            self.assertTrue( not ert_server.isConnected() )
            ert_server.open( self.config_file )
            self.assertTrue( ert_server.isConnected() )
            
            cmd = ["STATUS"]
            res = ert_server.evalCmd( cmd )
            self.assertEqual( res , ["READY"] )

            with self.assertRaises(ErtCmdError):
                res = ert_server.evalCmd( ["UNKNWON-COMMAND"])