Beispiel #1
0
    def test_env_list_filter_by_status(self):
        db.env_create("name 1", "STATUS42", "descr", {}, {}, {}, [])
        db.env_create("name 2", "STATUS42", "descr", {}, {}, {}, [])
        db.env_create("name 3", "STATUS43", "descr", {}, {}, {}, [])

        result = db.env_list("STATUS42")
        self.assertEqual(2, len(result))
        self.assertEqual(set(["name 1", "name 2"]),
                         set(r["name"] for r in result))
        result = db.env_list("STATUS43")
        self.assertEqual(1, len(result))
        self.assertEqual("name 3", result[0]["name"])
Beispiel #2
0
    def test_env_list(self):
        for i in range(3):
            db.env_create("name %s" % i, "STATUS42", "descr", {}, {}, {}, [])
            self.assertEqual(i + 1, len(db.env_list()))

        all_ = db.env_list()
        self.assertIsInstance(all_, list)
        for env in all_:
            self.assertIsInstance(env, dict)

        self.assertEqual(set("name %s" % i for i in range(3)),
                         set(e["name"] for e in db.env_list()))
Beispiel #3
0
    def test_env_list_filter_by_status(self):
        db.env_create("name 1", "STATUS42", "descr", {}, {}, {}, [])
        db.env_create("name 2", "STATUS42", "descr", {}, {}, {}, [])
        db.env_create("name 3", "STATUS43", "descr", {}, {}, {}, [])

        result = db.env_list("STATUS42")
        self.assertEqual(2, len(result))
        self.assertEqual(set(["name 1", "name 2"]),
                         set(r["name"] for r in result))
        result = db.env_list("STATUS43")
        self.assertEqual(1, len(result))
        self.assertEqual("name 3", result[0]["name"])
Beispiel #4
0
    def test_env_list(self):
        for i in range(3):
            db.env_create("name %s" % i, "STATUS42", "descr", {}, {}, {}, [])
            self.assertEqual(i + 1, len(db.env_list()))

        all_ = db.env_list()
        self.assertIsInstance(all_, list)
        for env in all_:
            self.assertIsInstance(env, dict)

        self.assertEqual(set("name %s" % i for i in range(3)),
                         set(e["name"] for e in db.env_list()))
Beispiel #5
0
    def test_env_delete_cascade(self):
        platforms = [{
            "status": "ANY",
            "plugin_name": "plugin_%s@plugin" % i,
            "plugin_spec": {},
            "platform_name": "plugin"
        } for i in range(3)]
        env = db.env_create("name", "status", "descr", {}, {}, {}, platforms)
        db.env_delete_cascade(env["uuid"])

        self.assertEqual(0, len(db.env_list()))
        self.assertEqual(0, len(db.platforms_list(env["uuid"])))
Beispiel #6
0
    def test_env_delete_cascade(self):
        platforms = [
            {
                "status": "ANY",
                "plugin_name": "plugin_%s@plugin" % i,
                "plugin_spec": {},
                "platform_name": "plugin"
            }
            for i in range(3)
        ]
        env = db.env_create("name", "status", "descr", {}, {}, {}, platforms)
        db.env_delete_cascade(env["uuid"])

        self.assertEqual(0, len(db.env_list()))
        self.assertEqual(0, len(db.platforms_list(env["uuid"])))
Beispiel #7
0
 def list(cls, status=None):
     """Returns list of instances of EnvManagers."""
     return [cls(data) for data in db.env_list(status=status)]
Beispiel #8
0
 def list(cls, status=None):
     """Returns list of instances of EnvManagers."""
     return [cls(data) for data in db.env_list(status=status)]