diff options
author | 2017-09-07 16:00:09 -0400 | |
---|---|---|
committer | 2017-09-07 17:30:55 -0400 | |
commit | f5ce303053c5560455572e39e1dbe6e5e7bf4c15 (patch) | |
tree | f2ce965381c793a56e73d69bea0f8f23cee5c6f8 /python-dockering/tests | |
parent | 5bc79f46cdbc93188c1fc47d73c02bba47ac3d07 (diff) |
Add in functionality for policy notification
Change-Id: I4ef4bc9c35266814f226cbad13c55d11901c8e79
Issue-Id: DCAEGEN2-97
Signed-off-by: Michael Hwang <mhwang@research.att.com>
Diffstat (limited to 'python-dockering/tests')
-rw-r--r-- | python-dockering/tests/test_core.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/python-dockering/tests/test_core.py b/python-dockering/tests/test_core.py index e99dbd4..f66f88c 100644 --- a/python-dockering/tests/test_core.py +++ b/python-dockering/tests/test_core.py @@ -25,6 +25,7 @@ from dockering import core as doc from dockering.exceptions import DockerError, DockerConnectionError +@pytest.mark.skip(reason="Need to automatically setup Docker engine and maybe Consul") def test_create_client(): # Bad - Could not connect to docker engine @@ -33,8 +34,8 @@ def test_create_client(): # TODO: Does pytest provide an env file? -CONSUL_HOST = os.environ["CONSUL_HOST"] -EXTERNAL_IP = os.environ["EXTERNAL_IP"] +CONSUL_HOST = os.environ.get("CONSUL_HOST") +EXTERNAL_IP = os.environ.get("EXTERNAL_IP") @pytest.mark.skip(reason="Need to automatically setup Docker engine and maybe Consul") def test_create_container(): @@ -69,3 +70,19 @@ def test_create_container(): doc.stop_then_remove_container(client, scn) except: print("Container removal failed") + + +def test_build_policy_update_cmd(): + assert ["/bin/sh", "/bin/foo", "policy", "{}"] == doc.build_policy_update_cmd("/bin/foo") + assert ["/bin/foo", "policy", "{}"] == doc.build_policy_update_cmd("/bin/foo", use_sh=False) + + kwargs = { "bar": "baz" } + + assert ["/bin/foo", "policy", "{\"bar\": \"baz\"}"] == doc.build_policy_update_cmd( + "/bin/foo", use_sh=False, **kwargs) + + assert ["/bin/foo", "policy", "{\"application_config\": {\"key\": \"hello world\"}}"] \ + == doc.build_policy_update_cmd("/bin/foo", use_sh=False, + application_config={"key": "hello world"}) + + |