Ejemplo n.º 1
0
    def test_modify_some_apps(self):
        data = {"id": "/", "apps": [{"id": "/foo"}, {"id": "/bla"}]}
        group = AsgardAppGroup(MarathonGroup.from_json(data))
        apps = list(group.iterate_apps())
        apps[0].id = "/foo0"
        apps[1].id = "/bla0"

        apps_modified = list(group.iterate_apps())
        self.assertEqual(["/foo0", "/bla0"], [app.id for app in apps_modified])
Ejemplo n.º 2
0
 def test_iterate_group_apps(self):
     data = {
         "id":
         "/",
         "groups": [{
             "id":
             "/foo",
             "apps": [{
                 "id": "/foo/app0"
             }, {
                 "id": "/foo/app1"
             }],
             "groups": [{
                 "id":
                 "/foo/bar",
                 "apps": [],
                 "groups": [{
                     "id":
                     "/foo/bar/baz",
                     "apps": [
                         {
                             "id": "/foo/bar/baz/app0"
                         },
                         {
                             "id": "/foo/bar/baz/app1"
                         },
                     ],
                 }],
             }],
         }],
         "apps": [{
             "id": "/app0"
         }, {
             "id": "/app1"
         }],
     }
     group = AsgardAppGroup(MarathonGroup.from_json(data))
     self.assertEqual(group.id, "/")
     expected_all_apps_ids = [
         "/app0",
         "/app1",
         "/foo/app0",
         "/foo/app1",
         "/foo/bar/baz/app0",
         "/foo/bar/baz/app1",
     ]
     returned_apps = list(group.iterate_apps())
     self.assertEqual(expected_all_apps_ids, [g.id for g in returned_apps])
Ejemplo n.º 3
0
 def test_iterate_empty_group(self):
     group = AsgardAppGroup()
     apps = list(group.iterate_apps())
     self.assertEqual(0, len(apps))