# Path: marathon/models/group.py
# class MarathonGroup(MarathonResource):
# 
#     """Marathon group resource.
# 
#     See: https://mesosphere.github.io/marathon/docs/rest-api.html#groups
# 
#     :param apps:
#     :type apps: list[:class:`marathon.models.app.MarathonApp`] or list[dict]
#     :param list[str] dependencies:
#     :param groups:
#     :type groups: list[:class:`marathon.models.group.MarathonGroup`] or list[dict]
#     :param str id:
#     :param pods:
#     :type pods: list[:class:`marathon.models.pod.MarathonPod`] or list[dict]
#     :param str version:
#     """
# 
#     def __init__(self, apps=None, dependencies=None,
#                  groups=None, id=None, pods=None, version=None, enforce_role=None):
#         self.apps = [
#             a if isinstance(a, MarathonApp) else MarathonApp().from_json(a)
#             for a in (apps or [])
#         ]
#         self.dependencies = dependencies or []
#         self.groups = [
#             g if isinstance(g, MarathonGroup) else MarathonGroup().from_json(g)
#             for g in (groups or [])
#         ]
#         self.pods = []
#         # ToDo: Create class MarathonPod
#         # self.pods = [
#         #     p if isinstance(p, MarathonPod) else MarathonPod().from_json(p)
#         #     for p in (pods or [])
#         # ]
#         self.id = id
#         self.version = version
#         self.enforce_role = enforce_role


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)

    def test_from_json_parses_group_with_enforce_role(self):
        data = {
                   "id": "/mygroup/works",
                   "groups": [
                       {"id": "/foo", "apps": []},
                   ],
                   "apps": [],
                   "enforceRole": False,

        }

# Path: marathon/models/group.py
# class MarathonGroup(MarathonResource):
# 
#     """Marathon group resource.
# 
#     See: https://mesosphere.github.io/marathon/docs/rest-api.html#groups
# 
#     :param apps:
#     :type apps: list[:class:`marathon.models.app.MarathonApp`] or list[dict]
#     :param list[str] dependencies:
#     :param groups:
#     :type groups: list[:class:`marathon.models.group.MarathonGroup`] or list[dict]
#     :param str id:
#     :param pods:
#     :type pods: list[:class:`marathon.models.pod.MarathonPod`] or list[dict]
#     :param str version:
#     """
# 
#     def __init__(self, apps=None, dependencies=None,
#                  groups=None, id=None, pods=None, version=None, enforce_role=None):
#         self.apps = [
#             a if isinstance(a, MarathonApp) else MarathonApp().from_json(a)
#             for a in (apps or [])
#         ]
#         self.dependencies = dependencies or []
#         self.groups = [
#             g if isinstance(g, MarathonGroup) else MarathonGroup().from_json(g)
#             for g in (groups or [])
#         ]
#         self.pods = []
#         # ToDo: Create class MarathonPod
#         # self.pods = [
#         #     p if isinstance(p, MarathonPod) else MarathonPod().from_json(p)
#         #     for p in (pods or [])
#         # ]
#         self.id = id
#         self.version = version
#         self.enforce_role = enforce_role


# Path: tests/test_model_group.py
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)

    def test_from_json_parses_group_with_enforce_role(self):
        data = {
                   "id": "/mygroup/works",
                   "groups": [
                       {"id": "/foo", "apps": []},
                   ],
                   "apps": [],
                   "enforceRole": False,

        }

        group = MarathonGroup().from_json(data)