Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Format --deprecated] Deprecated Beta Integration #4332

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/4332.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Fixed an issue using the **format** command with the **--deprecate** flag would not properly work on beta integrations.
type: fix
pr_number: 4332
14 changes: 12 additions & 2 deletions demisto_sdk/commands/format/tests/test_formatting_yml_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@

import pytest
import requests_mock
from pytest_mock import MockerFixture

from demisto_sdk.commands.common.constants import (
ALERT_FETCH_REQUIRED_PARAMS,
BETA_INTEGRATION,
FEED_REQUIRED_PARAMS,
GENERAL_DEFAULT_FROMVERSION,
INCIDENT_FETCH_REQUIRED_PARAMS,
INTEGRATION,
NO_TESTS_DEPRECATED,
MarketplaceVersions,
)
Expand Down Expand Up @@ -1441,6 +1444,7 @@ def test_set_fromversion_six_new_contributor_pack(self, pack):
bs.set_fromVersion()
assert bs.data["fromversion"] == GENERAL_DEFAULT_FROMVERSION, path

@pytest.mark.parametrize("file_type", [INTEGRATION, BETA_INTEGRATION])
@pytest.mark.parametrize(
"user_input, description_result",
[
Expand All @@ -1449,7 +1453,13 @@ def test_set_fromversion_six_new_contributor_pack(self, pack):
],
)
def test_update_deprecate_in_integration(
self, pack, mocker, monkeypatch, user_input, description_result
self,
pack: Pack,
mocker: MockerFixture,
monkeypatch: pytest.MonkeyPatch,
user_input: str,
description_result: str,
file_type: str,
):
"""
Given
Expand All @@ -1465,7 +1475,7 @@ def test_update_deprecate_in_integration(
BaseUpdateYML, "get_id_and_version_path_object", return_value={}
)
base_update_yml = BaseUpdateYML(input=integration.yml.path, deprecate=True)
base_update_yml.update_deprecate(file_type="integration")
base_update_yml.update_deprecate(file_type=file_type)

assert base_update_yml.data["deprecated"]
assert base_update_yml.data["tests"] == [NO_TESTS_DEPRECATED]
Expand Down
10 changes: 8 additions & 2 deletions demisto_sdk/commands/format/update_generic_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import click

from demisto_sdk.commands.common.constants import (
BETA_INTEGRATION,
ENTITY_TYPE_TO_DIR,
FILETYPE_TO_DEFAULT_FROMVERSION,
INTEGRATION,
Expand Down Expand Up @@ -366,10 +367,15 @@ def update_deprecate(self, file_type=None):

self.data["deprecated"] = True

if self.data.get("tests") or file_type in (INTEGRATION, PLAYBOOK, SCRIPT):
if self.data.get("tests") or file_type in (
INTEGRATION,
BETA_INTEGRATION,
PLAYBOOK,
SCRIPT,
):
self.data["tests"] = [NO_TESTS_DEPRECATED]

if file_type in [INTEGRATION, PLAYBOOK]:
if file_type in (INTEGRATION, BETA_INTEGRATION, PLAYBOOK):

description_field = "description"

Expand Down