Skip to content

Commit

Permalink
[Format --deprecated] Deprecated Beta Integration (#4332)
Browse files Browse the repository at this point in the history
* fix

* RN

* Update .changelog/4332.yml

* pre-commit

* Apply suggestions from code review

Co-authored-by: dorschw <[email protected]>

* typing

---------

Co-authored-by: dorschw <[email protected]>
  • Loading branch information
shmuel44 and dorschw authored Jun 10, 2024
1 parent b52c2ae commit f7db5ed
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
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

0 comments on commit f7db5ed

Please sign in to comment.