From 764ddde83ca12a82f81a4df5874b6e5d37a0c7c8 Mon Sep 17 00:00:00 2001 From: Connor Doyle Date: Tue, 17 Mar 2015 11:28:49 -0700 Subject: [PATCH] Fixed event emitter for unknown object types. - Added a boolean property to the test config. - Updated config integration tests. --- dcos/api/emitting.py | 6 ++---- integrations/cli/test_config.py | 13 +++++++++++-- tests/data/Dcos.toml | 8 +++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/dcos/api/emitting.py b/dcos/api/emitting.py index f065dec..75d2666 100644 --- a/dcos/api/emitting.py +++ b/dcos/api/emitting.py @@ -87,10 +87,8 @@ def print_handler(event): print(event.error(), file=sys.stderr) else: - logger.error( - 'Unable to print event. Type not supported: %s, %r.', - type(event), - event) + logger.debug('Printing unknown type: %s, %r.', type(event), event) + print(event) DEFAULT_HANDLER = print_handler diff --git a/integrations/cli/test_config.py b/integrations/cli/test_config.py index e2bb829..42f35a8 100644 --- a/integrations/cli/test_config.py +++ b/integrations/cli/test_config.py @@ -55,7 +55,8 @@ def test_list_property(env): env) assert returncode == 0 - assert stdout == b"""marathon.host=localhost + assert stdout == b"""foo.bar=True +marathon.host=localhost marathon.port=8080 package.cache=tmp/cache package.sources=['git://github.com/mesosphere/universe.git', \ @@ -64,10 +65,18 @@ package.sources=['git://github.com/mesosphere/universe.git', \ assert stderr == b'' -def test_get_existing_property(env): +def test_get_existing_string_property(env): _get_value('marathon.host', 'localhost', env) +def test_get_existing_integral_property(env): + _get_value('marathon.port', 8080, env) + + +def test_get_existing_boolean_property(env): + _get_value('foo.bar', True, env) + + def test_get_missing_property(env): _get_missing_value('missing.property', env) diff --git a/tests/data/Dcos.toml b/tests/data/Dcos.toml index ec5ff8a..fb2db44 100644 --- a/tests/data/Dcos.toml +++ b/tests/data/Dcos.toml @@ -1,6 +1,8 @@ -[package] -sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",] -cache = "tmp/cache" +[foo] +bar = true [marathon] host = "localhost" port = 8080 +[package] +sources = [ "git://github.com/mesosphere/universe.git", "https://github.com/mesosphere/universe/archive/master.zip",] +cache = "tmp/cache"