Example #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()
Example #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
Example #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()
Example #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()
Example #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"
Example #6
0
 def teardown_method(self):
     config.reset()