def test_is_duplicate_description_given(pack, mocker):
    """
    Given:
        - Description file path

    When:
        - Running detailed description validator on the integration.

    Then:
        - Ensure validation passes
        - Ensure handle error is not called.
    """
    mocker.patch.object(DescriptionValidator, 'handle_error')
    integration = pack.create_integration()
    integration.create_default_integration()
    description_validator = DescriptionValidator(integration.description.path)
    assert description_validator.is_duplicate_description()
    assert not DescriptionValidator.handle_error.called
예제 #2
0
def test_is_duplicate_description_unified_deprecated_integration(mocker, tmp_path, integration_obj):
    """
    Given:
        - Case A: Content pack with unified integration
        - Case B: Content pack with deprecated integration

    When:
        - Running detailed description validator on the integration

    Then:
        - Ensure validation passes
        - Ensure no warning is printed
    """
    mocker.patch.object(DescriptionValidator, 'handle_error')
    integration_dir = tmp_path / 'Packs' / 'SomePack' / 'Integrations' / 'SomeIntegration'
    integration_dir.mkdir(parents=True)
    unified_integration_yml = integration_dir / 'SomeIntegration.yml'
    yaml.dump(integration_obj, unified_integration_yml.open('w'), default_flow_style=False)
    description_validator = DescriptionValidator(str(unified_integration_yml))
    assert description_validator.is_duplicate_description()
    assert not DescriptionValidator.handle_error.called