Ejemplo n.º 1
0
 def clearEnv(self):
     if "PYRO_HOST" in os.environ:
         del os.environ["PYRO_HOST"]
     if "PYRO_NS_PORT" in os.environ:
         del os.environ["PYRO_NS_PORT"]
     if "PYRO_COMPRESSION" in os.environ:
         del os.environ["PYRO_COMPRESSION"]
     config.reset()
Ejemplo n.º 2
0
 def testConfig(self):
     self.clearEnv()
     try:
         assert config.NS_PORT == 9090
         assert config.HOST == "localhost"
         assert config.COMPRESSION == False
         os.environ["NS_PORT"] = "4444"
         config.reset()
         assert config.NS_PORT == 9090
         os.environ["PYRO_NS_PORT"] = "4444"
         os.environ["PYRO_HOST"] = "something.com"
         os.environ["PYRO_COMPRESSION"] = "OFF"
         config.reset()
         assert config.NS_PORT == 4444
         assert config.HOST == "something.com"
         assert config.COMPRESSION == False
     finally:
         self.clearEnv()
         assert config.NS_PORT == 9090
         assert config.HOST == "localhost"
         assert config.COMPRESSION == False
Ejemplo n.º 3
0
 def testConfigParseBool(self):
     config = Pyro5.configure.Configuration()
     assert type(config.COMPRESSION) is bool
     os.environ["PYRO_COMPRESSION"] = "yes"
     config.reset()
     assert config.COMPRESSION
     os.environ["PYRO_COMPRESSION"] = "off"
     config.reset()
     assert not config.COMPRESSION
     os.environ["PYRO_COMPRESSION"] = "foobar"
     with pytest.raises(ValueError):
         config.reset()
     del os.environ["PYRO_COMPRESSION"]
     config.reset()
Ejemplo n.º 4
0
 def testConfigReset(self):
     try:
         config.reset()
         assert config.HOST == "localhost"
         config.HOST = "foobar"
         assert config.HOST == "foobar"
         config.reset()
         assert config.HOST == "localhost"
         os.environ["PYRO_HOST"] = "foobar"
         config.reset()
         assert config.HOST == "foobar"
         del os.environ["PYRO_HOST"]
         config.reset()
         assert config.HOST == "localhost"
     finally:
         self.clearEnv()
Ejemplo n.º 5
0
 def testConfigDefaults(self):
     # some security sensitive settings:
     config.reset(False)  # reset the config to default
     assert config.HOST == "localhost"
     assert config.NS_HOST == "localhost"
     assert config.SERIALIZER == "serpent"
Ejemplo n.º 6
0
 def teardown_method(self):
     config.reset()