def test_find_or_create_version__already_exists(self): responses.add( "GET", "https://metadeploy/versions?product=abcdef&label=1.0", json={"data": [{ "url": "http://EXISTING_VERSION" }]}, ) project_config = create_project_config() project_config.keychain.set_service( "metadeploy", ServiceConfig({ "url": "https://metadeploy", "token": "TOKEN" })) task_config = TaskConfig({ "options": { "flow": "install_prod", "product_id": "abcdef", "tag": "release/1.0", "title": "Test Product", "slug": "test", "tier": "primary", } }) task = Publish(project_config, task_config) task._init_task() version = task._find_or_create_version() self.assertEqual("http://EXISTING_VERSION", version["url"])
def test_find_or_create_version__commit(self): responses.add( "GET", "https://metadeploy/versions?product=abcdef&label=abcdef", json={"data": [{"url": "http://EXISTING_VERSION"}]}, ) project_config = create_project_config() project_config.config["project"]["git"]["repo_url"] = "EXISTING_REPO" project_config.config["plans"] = { "install": { "title": "Test Install", "slug": "install", "tier": "primary", "steps": {1: {"flow": "install_prod"}}, } } project_config.keychain.set_service( "metadeploy", ServiceConfig({"url": "https://metadeploy", "token": "TOKEN"}) ) task_config = TaskConfig({"options": {"commit": "abcdef"}}) task = Publish(project_config, task_config) task._init_task() version = task._find_or_create_version( {"url": "http://EXISTING_PRODUCT", "id": "abcdef"} ) self.assertEqual("http://EXISTING_VERSION", version["url"])
def test_find_or_create_version__already_exists(self): responses.add( "GET", "https://metadeploy/versions?product=abcdef&label=1.0", json={"data": [{"url": "http://EXISTING_VERSION"}]}, ) project_config = create_project_config() project_config.config["project"]["git"]["repo_url"] = "EXISTING_REPO" project_config.config["plans"] = { "install": { "title": "Test Install", "slug": "install", "tier": "primary", "steps": {1: {"flow": "install_prod"}}, } } project_config.keychain.set_service( "metadeploy", ServiceConfig({"url": "https://metadeploy", "token": "TOKEN"}) ) task_config = TaskConfig({"options": {"tag": "release/1.0"}}) task = Publish(project_config, task_config) task._init_task() version = task._find_or_create_version( {"url": "http://EXISTING_PRODUCT", "id": "abcdef"} ) self.assertEqual("http://EXISTING_VERSION", version["url"])