Skip to content

Commit

Permalink
Hello world saas (#30901)
Browse files Browse the repository at this point in the history
* added a new incident field only for saas mp

* added an incident field to xsoar_saas only for demonstration

* format incident field

* format incident field

* added saas word to known words

* version

* merge with master

* fixed the xsoar_saas end tag

* Added tests to validate result

* modified RN

* pre commit changes

* RN tags

* ignoe long line
  • Loading branch information
omerKarkKatz committed Nov 28, 2023
1 parent 1ddf72d commit d3679f5
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 5 deletions.
@@ -0,0 +1,34 @@
{
"id": "incident_helloworldsaas",
"version": -1,
"modified": "0001-01-01T00:00:00Z",
"name": "HelloWorld SaaS",
"ownerOnly": false,
"cliName": "helloworldsaas",
"type": "shortText",
"closeForm": false,
"editForm": true,
"required": false,
"neverSetAsRequired": false,
"isReadOnly": false,
"useAsKpi": false,
"locked": false,
"system": false,
"content": true,
"group": 0,
"hidden": false,
"openEnded": false,
"associatedTypes": [
"Hello World Alert"
],
"associatedToAll": false,
"unmapped": false,
"unsearchable": true,
"caseInsensitive": true,
"sla": 0,
"threshold": 72,
"marketplaces": [
"xsoar_saas"
],
"fromVersion": "6.10.0"
}
5 changes: 5 additions & 0 deletions Packs/HelloWorld/ReleaseNotes/3_0_1.md
@@ -0,0 +1,5 @@

#### Incident Fields
<~XSOAR_SAAS>
- New: **HelloWorld SaaS**
</~XSOAR_SAAS>
2 changes: 1 addition & 1 deletion Packs/HelloWorld/pack_metadata.json
Expand Up @@ -2,7 +2,7 @@
"name": "HelloWorld",
"description": "This is the Hello World integration for getting started.",
"support": "community",
"currentVersion": "3.0.0",
"currentVersion": "3.0.1",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
87 changes: 86 additions & 1 deletion Tests/Marketplace/Tests/marketplace_services_test.py
Expand Up @@ -1600,6 +1600,85 @@ def test_filter_for_xsoar_tags(self, dummy_pack: Pack, upload_marketplace, expec
result = dummy_pack.filter_release_notes_by_tags(self.RN_ENTRY_XSOAR_TAGS, upload_marketplace)
assert result == expected_result

TEST1 = """#### Integrations
##### ServiceNow v2
- Fixed the test button to work with debug mode."""

res1 = {'Integrations': {'ServiceNow v2': '- Fixed the test button to work with debug mode.\n'}}

TEST2 = """#### Incident Fields
- **Claroty Category**"""

res2 = {'Incident Fields': {'[special_msg]': '- **Claroty Category**\n'}}

res_original_regex = {}

TEST3 = """#### Integrations
##### Ansible Cisco NXOS
- Documentation and metadata improvements.
- Fixed contextPath outputs for the ***nxos-facts*** command.
- Updated the Docker image to: *demisto/ansible-runner:1.0.0.24037*."""

res3 = {'Integrations': {'Ansible Cisco NXOS': '- Documentation and metadata improvements.\n- Fixed contextPath outputs for the ***nxos-facts*** command.\n- Updated the Docker image to: *demisto/ansible-runner:1.0.0.24037*.\n'}} # noqa: E501

TEST4 = """#### Integrations
##### Akamai WAF
- Added 8 new commmands:
- ***akamai-get-production-deployment***
- ***akamai-get-change-history***
- ***akamai-modify-appsec-config-selected-hosts***
- ***akamai-patch-papi-property-rule-siteshield***
- ***akamai-update-appsec-config-version-notes***
- ***akamai-new-or-renew-match-target***
- ***akamai-patch-papi-property-rule-generic***
- ***akamai-get-papi-property-rule***
- Added the following arguments to the ***akamai-create-enrollment*** command:
- *clone_dns_names*
- *exclude_sans*
- *change_management*
- *network_configuration_geography*
- *ra*
- *validation_type*
- *enable_multi_stacked_certificates*
- *network_configuration_quic_enabled*
- *network_configuration_secure_network*
- *network_configuration_sni_only*
- *indicator_type*
- *active_only*
- *confidence*
- *threat_assess_score*
- Added the following arguments to the ***akamai-update-property*** command:
- *property_comments*
- *dc1_id*
- *dc2_id*
- Added the following argument to the ***akamai-activate-papi-property*** command:
- *note*
"""

res4 = {'Integrations': {'Akamai WAF': '- Added 8 new commmands:\n - ***akamai-get-production-deployment***\n - ***akamai-get-change-history***\n - ***akamai-modify-appsec-config-selected-hosts***\n - ***akamai-patch-papi-property-rule-siteshield***\n - ***akamai-update-appsec-config-version-notes***\n - ***akamai-new-or-renew-match-target***\n - ***akamai-patch-papi-property-rule-generic***\n - ***akamai-get-papi-property-rule***\n\n- Added the following arguments to the ***akamai-create-enrollment*** command:\n - *clone_dns_names*\n - *exclude_sans*\n - *change_management*\n - *network_configuration_geography*\n - *ra*\n - *validation_type*\n - *enable_multi_stacked_certificates*\n - *network_configuration_quic_enabled*\n - *network_configuration_secure_network*\n - *network_configuration_sni_only*\n - *indicator_type*\n - *active_only*\n - *confidence*\n - *threat_assess_score*\n\n- Added the following arguments to the ***akamai-update-property*** command:\n - *property_comments*\n - *dc1_id*\n - *dc2_id*\n\n- Added the following argument to the ***akamai-activate-papi-property*** command:\n - *note*\n'}} # noqa: E501

Test5 = """#### Incident Fields"""

res5 = {'Incident Fields': {'[special_msg]': '\n'}}

@pytest.mark.parametrize('test, res', [(TEST1, res1), (TEST2, res2), (TEST3, res3), (TEST4, res4), (Test5, res5)])
def test_get_relese_notes_dict(self, dummy_pack: Pack, test, res):
"""
This test was added after changing the rexgex - ENTITY_TYPE_SECTION_REGEX
to check same results before and after change.
Given:
- Release notes after before and after filter.
When:
- Preparing the release notes in the upload after the tags were filtered out.
Then:
- Validate that the release notes dict is build properly.
"""
assert dummy_pack.get_release_notes_dict('3.0.1', test) == res

@pytest.mark.parametrize('id_set, expected_result', [
({"integrations": [{'id': {"display_name": "Display Name 2"}}],
"IncidentFields": [{'id': {"display_name": "Field name 1"}}, {'id': {"display_name": "Field name 3"}}]},
Expand Down Expand Up @@ -1629,7 +1708,13 @@ def test_filter_by_display_name(self, dummy_pack: Pack, id_set, expected_result)
@pytest.mark.parametrize('changelog_entry, marketplace, id_set, expected_rn', [
({Changelog.RELEASE_NOTES: '#### Integrations\n##### Display Name\n- Some entry 1.\n- Some entry 2.'},
'xsoar', {"integrations": [{'id': {'display_name': 'Display Name'}}]},
'#### Integrations\n##### Display Name\n- Some entry 1.\n- Some entry 2.')
'#### Integrations\n##### Display Name\n- Some entry 1.\n- Some entry 2.'),
({Changelog.RELEASE_NOTES: """#### Incident Fields
<~XSOAR_SAAS>
- New: **HelloWorld SaaS**
</~XSOAR_SAAS>"""},
'xsoar', {"integrations": [{'id': {'display_name': 'Display Name'}}]},
'Changes are not relevant for XSOAR marketplace.')
])
def test_changes_not_relevant_message_in_rn(self, dummy_pack: Pack, changelog_entry,
marketplace, id_set, expected_rn):
Expand Down
2 changes: 1 addition & 1 deletion Tests/Marketplace/marketplace_constants.py
Expand Up @@ -32,7 +32,7 @@
XPANSE_START_TAG = "<~XPANSE>"
XPANSE_END_TAG = "</~XPANSE>"
XSOAR_SAAS_START_TAG = "<~XSOAR_SAAS>"
XSOAR_SAAS_END_TAG = "<~/XSOAR_SAAS>"
XSOAR_SAAS_END_TAG = "</~XSOAR_SAAS>"
XSOAR_ON_PREM_TAG = "<~XSOAR_ON_PREM>"
XSOAR_ON_PREM_END_TAG = "</~XSOAR_ON_PREM>"

Expand Down
2 changes: 1 addition & 1 deletion Tests/Marketplace/marketplace_services.py
Expand Up @@ -1589,7 +1589,7 @@ def remove_tags_section_from_rn(release_notes, marketplace, upload_marketplace):
release_notes = remove_tags_section_from_rn(release_notes, XPANSE_MP, upload_marketplace)

logging.debug(f"RN result after filtering for pack {self._pack_name} in marketplace "
f"{upload_marketplace}\n - {release_notes}")
f"{upload_marketplace} -\n {release_notes}")

return release_notes

Expand Down
2 changes: 2 additions & 0 deletions Tests/known_words.txt
Expand Up @@ -247,3 +247,5 @@ sdk
RFC
datetime
HSTS
SaaS
saas
2 changes: 1 addition & 1 deletion Utils/release_notes_generator.py
Expand Up @@ -20,7 +20,7 @@

EMPTY_LINES_REGEX = re.compile(r'\s*-\s*\n')
IGNORED_LINES_REGEX = re.compile(r'<!-[\W\w]*?-->')
ENTITY_TYPE_SECTION_REGEX = re.compile(r'^#### ([\w ]+)$\n([\w\W]*?)(?=^#### )|^#### ([\w ]+)$\n([\w\W]*)', re.M)
ENTITY_TYPE_SECTION_REGEX = re.compile(r'^#### ([\w ]+)([\w\W]*?)(?=^#### )|^#### ([\w ]+)([\w\W]*)', re.M)
ENTITY_SECTION_REGEX = re.compile(r'^##### (.+)$\n([\w\W]*?)(?=^##### )|^##### (.+)$\n([\w\W]*)|'
r'^- \*\*(.+)\*\*$\n([\w\W]*)', re.M)
PACK_GENERAL_NOTES_REGEX = re.compile(r'^## (.+)$\n([\w\W]*?)(?=^#### )|^## ([\w ]+)$\n([\w\W]*)', re.M)
Expand Down

0 comments on commit d3679f5

Please sign in to comment.