コード例 #1
0
 def test_7_timeout(self):
     client = ResourceManagerClient('127.0.0.1', SERVER_PORT, _debug=True)
     try:
         client.read_config()
     except TimeoutError:
         return
     raise AssertionError("Expected a timeout error")
コード例 #2
0
    def test_6_reconfigure(self):
        client = ResourceManagerClient('127.0.0.1', SERVER_PORT, _debug=True)
        orig_config = client.read_config()

        new_config = orig_config.copy()
        new_config["read_reqs"] = 123
        new_config["write_reqs"] = 456

        client.reconfigure_server(new_config)
        assert client.read_config() == new_config
コード例 #3
0
 def test_1_basic(self):
     """
     Request access to a resource.
     """
     resource = 'my-resource'
     client = ResourceManagerClient('127.0.0.1', SERVER_PORT, _debug=True)
     assert client.read_config()["write_reqs"] == 2
     with client.access_context(resource, False, 1, 1000):
         pass