Example #1
0
    def test_update_manifest_no_envs(self):
        """Try not to add any envs"""
        j = copy.deepcopy(MANIFEST)

        j = Application.update_manifest(j, APP_NAME, SERVICES, None)

        assert j["type"] == APP_TYPE
        assert j["name"] == APP_NAME
        assert j["instances"] == NO_INSTANCES
        assert j["services"] == SERVICES
        assert j["env"][ENV_NAME] == ENV_VAL
        assert len(j["env"]) == 1
Example #2
0
    def test_update_manifest(self):
        """Tests if update manifest method works."""
        j = copy.deepcopy(MANIFEST)

        j = Application.update_manifest(j, APP_NAME, SERVICES, ENVS)

        assert j["type"] == APP_TYPE
        assert j["name"] == APP_NAME
        assert j["instances"] == NO_INSTANCES
        assert j["services"] == SERVICES
        assert j["env"][ENV_NAME] == ENV_VAL
        assert j["env"][NEW_ENV_01] == NEW_ENV_01_VAL
        assert j["env"][NEW_ENV_02] == NEW_ENV_02_VAL
Example #3
0
    def test_update_manifest_with_no_envs(self):
        """Update a manifest that has no envs defined"""
        j = copy.deepcopy(MANIFEST)
        del j["env"]

        j = Application.update_manifest(j, APP_NAME, SERVICES, ENVS)

        assert j["type"] == APP_TYPE
        assert j["name"] == APP_NAME
        assert j["instances"] == NO_INSTANCES
        assert j["services"] == SERVICES
        assert j["env"][NEW_ENV_01] == NEW_ENV_01_VAL
        assert j["env"][NEW_ENV_02] == NEW_ENV_02_VAL
        assert len(j["env"]) == 2
Example #4
0
    def test_update_manifest_delete_services(self):
        """Deletes services provided already present in manifest"""
        j = copy.deepcopy(MANIFEST)

        j = Application.update_manifest(j, APP_NAME, None, ENVS)

        assert j["type"] == APP_TYPE
        assert j["name"] == APP_NAME
        assert j["instances"] == NO_INSTANCES
        with pytest.raises(KeyError):
            j["services"]
        assert j["env"][ENV_NAME] == ENV_VAL
        assert j["env"][NEW_ENV_01] == NEW_ENV_01_VAL
        assert j["env"][NEW_ENV_02] == NEW_ENV_02_VAL
Example #5
0
    def test_update_manifest_no_env_with_proxy_no_env(self):
        """Check if cf_proxy is present we get proxy env, no env is present
        in manifest, no envs were provided"""
        j = copy.deepcopy(MANIFEST)
        del j["env"]

        j = Application.update_manifest(j, APP_NAME, SERVICES, None)

        assert j["type"] == APP_TYPE
        assert j["name"] == APP_NAME
        assert j["instances"] == NO_INSTANCES
        assert j["services"] == SERVICES
        assert j["env"]["http_proxy"] == "http://" + self.HTTP_PROXY + ":911"
        assert j["env"]["https_proxy"] == "https://" + self.HTTP_PROXY + ":912"
        assert len(j["env"]) == 2
Example #6
0
    def test_update_manifest_with_proxy(self):
        """Check if cf_proxy is present we get proxy env"""
        j = copy.deepcopy(MANIFEST)

        j = Application.update_manifest(j, APP_NAME, SERVICES, ENVS)

        assert j["type"] == APP_TYPE
        assert j["name"] == APP_NAME
        assert j["instances"] == NO_INSTANCES
        assert j["services"] == SERVICES
        assert j["env"][ENV_NAME] == ENV_VAL
        assert j["env"][NEW_ENV_01] == NEW_ENV_01_VAL
        assert j["env"][NEW_ENV_02] == NEW_ENV_02_VAL
        assert j["env"]["http_proxy"] == "http://" + self.HTTP_PROXY + ":911"
        assert j["env"]["https_proxy"] == "https://" + self.HTTP_PROXY + ":912"