diff --git a/marathon/models/base.py b/marathon/models/base.py index ecc8030..db77076 100644 --- a/marathon/models/base.py +++ b/marathon/models/base.py @@ -13,7 +13,7 @@ def __repr__(self): def __eq__(self, other): try: return self.__dict__ == other.__dict__ - except: + except Exception: return False def __hash__(self): @@ -68,7 +68,7 @@ def __repr__(self): def __eq__(self, other): try: return self.__dict__ == other.__dict__ - except: + except Exception: return False def __hash__(self): diff --git a/marathon/models/group.py b/marathon/models/group.py index c7c0339..bb4f6bc 100644 --- a/marathon/models/group.py +++ b/marathon/models/group.py @@ -1,4 +1,4 @@ -from .base import MarathonResource, assert_valid_id +from .base import MarathonResource from .app import MarathonApp @@ -36,5 +36,5 @@ def __init__(self, apps=None, dependencies=None, # p if isinstance(p, MarathonPod) else MarathonPod().from_json(p) # for p in (pods or []) # ] - self.id = assert_valid_id(id) + self.id = id self.version = version diff --git a/tests/test_model_group.py b/tests/test_model_group.py new file mode 100644 index 0000000..fb84c04 --- /dev/null +++ b/tests/test_model_group.py @@ -0,0 +1,19 @@ +# encoding: utf-8 + +from marathon.models.group import MarathonGroup +import unittest + + +class MarathonGroupTest(unittest.TestCase): + + def test_from_json_parses_root_group(self): + data = { + "id": "/", + "groups": [ + {"id": "/foo", "apps": []}, + {"id": "/bla", "apps": []}, + ], + "apps": [] + } + group = MarathonGroup().from_json(data) + self.assertEqual("/", group.id)