Example #1
0
    def test_query_state(self):
        api_client = MSClient(configuration=Configuration(
            host="0.0.0.0",
            username="******",
            api_key="abcdefge",
            verify_ssl=False,
        ))

        test_value = 12312
        updates = {
            "container_network": "192.169.16.0/28",
            "subnet": "10.0.2.0/24",
            "test_key": test_value,
        }

        api_client.update_state(updates)
        assert api_client.query_state("test_key") == test_value
Example #2
0
    def test_update_client_state(self):
        api_client = MSClient(configuration=Configuration(
            host="0.0.0.0",
            username="******",
            api_key="abcdefge",
            verify_ssl=False,
        ))

        updates = {
            "topology_container_network": "192.169.16.0/24",
            "subnet": "10.0.2.0/24",
        }
        api_client.update_state(updates)
        state = api_client.state
        assert set(updates.keys()).issubset(set(state.keys()))
        assert state["subnet"] == updates["subnet"]
        assert len(state) == 2