Exemple #1
0
    def test_env_update(self):
        env = db.env_create("name", "status", "descr", {}, {}, {}, [])
        self.assertTrue(db.env_update(env["uuid"]))
        self.assertTrue(
            db.env_update(env["uuid"], "another_descr", {"e": 123}, {"c": 1}))

        env = db.env_get(env["uuid"])
        self.assertEqual("another_descr", env["description"])
        self.assertEqual({"e": 123}, env["extras"])
        self.assertEqual({"c": 1}, env["config"])
Exemple #2
0
    def test_env_update(self):
        env = db.env_create("name", "status", "descr", {}, {}, {}, [])
        self.assertTrue(db.env_update(env["uuid"]))
        self.assertTrue(
            db.env_update(env["uuid"], "another_descr", {"e": 123}, {"c": 1}))

        env = db.env_get(env["uuid"])
        self.assertEqual("another_descr", env["description"])
        self.assertEqual({"e": 123}, env["extras"])
        self.assertEqual({"c": 1}, env["config"])
Exemple #3
0
    def update(self, description=None, config=None, extras=None):
        """Update description and extras for environment.

        :param description: New description for env
        :param extras: New extras for env
        """
        return db.env_update(
            self.uuid, description=description, config=config, extras=extras)
Exemple #4
0
    def update(self, description=None, config=None, extras=None):
        """Update description and extras for environment.

        :param description: New description for env
        :param extras: New extras for env
        """
        return db.env_update(
            self.uuid, description=description, config=config, extras=extras)
Exemple #5
0
    def update(self, description=None, extras=None):
        """Update description and extras for environment.

        :param description: New description for env
        :param extras: New extras for env
        """
        values = {}

        if description and description != self._env["description"]:
            values["description"] = description
        if extras and extras != self._env["extras"]:
            values["extras"] = extras

        if values:
            return db.env_update(self.uuid, **values)
        return True