Ejemplo n.º 1
0
    def test_should_get_value(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()
        env.put_value("adobe_host", "foobar.com")

        env_from_db = AppEnvironment.objects(app=app)[0]
        self.assertEquals("foobar.com", env_from_db.get_value("adobe_host"))
Ejemplo n.º 2
0
    def test_should_return_true_if_key_exists(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()
        env.put_value("adobe_host", "foobar.com")

        env_from_db = AppEnvironment.objects(app=app)[0]
        self.assertTrue(env_from_db.has_key("adobe_host"))
Ejemplo n.º 3
0
    def test_should_return_true_if_key_exists(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()
        env.put_value("adobe_host", "foobar.com")

        env_from_db = AppEnvironment.objects(app=app)[0]
        self.assertTrue(env_from_db.has_key("adobe_host"))
Ejemplo n.º 4
0
    def test_should_get_value(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()
        env.put_value("adobe_host", "foobar.com")

        env_from_db = AppEnvironment.objects(app=app)[0]
        self.assertEquals("foobar.com", env_from_db.get_value("adobe_host"))
Ejemplo n.º 5
0
    def test_should_put_new_key_value(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()
        env.put_value("adobe_host", "foobar.com")

        env_from_db = AppEnvironment.objects(app=app)[0]
        self.assertIsNotNone(env_from_db)
        entry = env_from_db.entries.get("adobe_host")
        self.assertIsNotNone(entry)
        self.assertEquals("foobar.com", entry.value)
Ejemplo n.º 6
0
    def test_should_put_new_key_value(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()
        env.put_value("adobe_host", "foobar.com")

        env_from_db = AppEnvironment.objects(app=app)[0]
        self.assertIsNotNone(env_from_db)
        entry = env_from_db.entries.get("adobe_host")
        self.assertIsNotNone(entry)
        self.assertEquals("foobar.com", entry.value)
Ejemplo n.º 7
0
    def test_should_create_env(self):
        app = Application(name="lms").save()

        app.create_env("usc-mat-sb01")

        env_from_db = AppEnvironment.objects(app=app)[0]

        self.assertIsNotNone(env_from_db)
Ejemplo n.º 8
0
    def test_should_get_env(self):
        app = Application(name="lms").save()
        env = AppEnvironment(name="usc-mat-sb01", app=app).save()

        env_from_db = app.get_env("usc-mat-sb01")
        self.assertIsNotNone(env_from_db)

        env_from_db = app.get_env("non-existent-env")
        self.assertIsNone(env_from_db)
Ejemplo n.º 9
0
    def test_should_save_env(self):
        app = Application(name="lms").save()
        AppEnvironment(name="usc-mat-sb01", app=app).save()

        self.assertEquals("usc-mat-sb01",
                          AppEnvironment.objects(app=app)[0].name)
Ejemplo n.º 10
0
 def create_env(self, env_name):
     AppEnvironment(name=env_name, app=self).save()
Ejemplo n.º 11
0
 def get_env(self, env_name):
     result = AppEnvironment.objects((Q(name=env_name) & Q(app=self)))
     if len(result) > 0:
         return result[0]
     return None
Ejemplo n.º 12
0
    def test_should_save_env(self):
        app = Application(name="lms").save()
        AppEnvironment(name="usc-mat-sb01", app=app).save()

        self.assertEquals("usc-mat-sb01", AppEnvironment.objects(app=app)[0].name)