Salesforce Fusion IAM
Integrate with Salesforce Fusion Identity Access Management service to execute CRUD (create, read, update, and delete) operations for employee lifecycle processes.
Authentication & Identity Management · Salesforce Fusion
Details
| ID | Salesforce Fusion IAM |
|---|---|
| Provider | Salesforce |
| Category | Authentication & Identity Management |
| From Version | 6.0.0 |
| Docker Image | demisto/python3:3.12.13.10116658 |
| Supported Modules | Agentix XSIAM EDR Cortex Cloud Cloud Runtime Security |
README
Integrate with Salesforce Fusion Identity Access Management service to execute CRUD (create, read, update, and delete) operations for employee lifecycle processes.
For more information, refer to the Identity Lifecycle Management article.
Configure Salesforce Fusion IAM in Cortex
| Parameter | Description | Required |
|---|---|---|
| Base URL | True | |
| User name | True | |
| Password | True | |
| Client ID | False | |
| Client secret | False | |
| Secret token | False | |
| Allow creating users | False | |
| Allow updating users | False | |
| Allow enabling users | False | |
| Allow disabling users | False | |
| Automatically create user if not found in update command | False | |
| Incoming Mapper | True | |
| Outgoing Mapper | Cortex XSOAR only parameter. | False |
| Trust any certificate (not secure) | False | |
| Use system proxy settings | False |
Commands
You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
iam-create-user
Creates a user.
Base Command
iam-create-user
Input
| Argument Name | Description | Required |
|---|---|---|
| user-profile | The User Profile indicator. | Required |
| allow-enable | When set to true, after the command execution the status of the user in the 3rd-party integration will be active. Possible values are: true, false. Default is true. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| IAM.Vendor.active | Boolean | When true, indicates that the employee’s status is active in the 3rd-party integration. |
| IAM.Vendor.brand | String | Name of the integration. |
| IAM.Vendor.details | string | Provides the raw data from the 3rd-party integration. |
| IAM.Vendor.email | String | The employee’s email address. |
| IAM.Vendor.errorCode | Number | HTTP error response code. |
| IAM.Vendor.errorMessage | String | Reason why the API failed. |
| IAM.Vendor.id | String | The employee’s user ID in the app. |
| IAM.Vendor.instanceName | string | Name of the integration instance. |
| IAM.Vendor.success | Boolean | When true, indicates that the command was executed successfully. |
| IAM.Vendor.username | String | The employee’s username in the app. |
Command Example
!iam-create-user user-profile={\"email\": \"john.doe@example.com\", \"givenname\": \"John\", \"surname\": \"Doe\"}
Human Readable Output
Create User Results (Salesforce Fusion IAM)
| brand | instanceName | success | active | id | username | details | |
|---|---|---|---|---|---|---|---|
| Salesforce Fusion IAM | Salesforce Fusion IAM_instance_1 | true | true | 00uujxnbh3uJw4tWA0h7 | john.doe@example.com | john.doe@example.com | id: 00uujxnbh3uJw4tWA0h7 status: PROVISIONED created: 2020-10-18T17:54:30.000Z activated: 2020-10-18T17:54:30.000Z statusChanged: 2020-10-18T17:54:30.000Z lastLogin: null lastUpdated: 2020-10-18T17:54:30.000Z passwordChanged: null type: {“id”: “oty8zfz6plq7b0r830h7”} profile: {“firstName”: “John”, “lastName”: “Doe”, “mobilePhone”: null, “secondEmail”: null, “login”: “john.doe@example.com”, “email”: “john.doe@example.com”} credentials: {“provider”: {“type”: “Salesforce Fusion”, “name”: “Salesforce Fusion”}} |
iam-update-user
Updates an existing user with the data passed in the user-profile argument.
Base Command
iam-update-user
Input
| Argument Name | Description | Required |
|---|---|---|
| user-profile | The User Profile indicator. | Required |
| allow-enable | When set to true, after the command execution the status of the user in the 3rd-party integration will be active. Possible values are: true, false. Default is true. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| IAM.Vendor.active | Boolean | When true, indicates that the employee’s status is active in the 3rd-party integration. |
| IAM.Vendor.brand | String | Name of the integration. |
| IAM.Vendor.details | string | Provides the raw data from the 3rd-party integration. |
| IAM.Vendor.email | String | The employee’s email address. |
| IAM.Vendor.errorCode | Number | HTTP error response code. |
| IAM.Vendor.errorMessage | String | Reason why the API failed. |
| IAM.Vendor.id | String | The employee’s user ID in the app. |
| IAM.Vendor.instanceName | string | Name of the integration instance. |
| IAM.Vendor.success | Boolean | When true, indicates that the command was executed successfully. |
| IAM.Vendor.username | String | The employee’s username in the app. |
Command Example
!iam-update-user user-profile={\"email\": \"john.doe@example.com\", \"givenname\": \"John\"}
Human Readable Output
Update User Results (Salesforce Fusion IAM)
| brand | instanceName | success | active | id | username | details | |
|---|---|---|---|---|---|---|---|
| Salesforce Fusion IAM | Salesforce Fusion IAM_instance_1 | true | true | 00uujxnbh3uJw4tWA0h7 | john.doe@example.com | john.doe@example.com | id: 00uujxnbh3uJw4tWA0h7 status: PROVISIONED created: 2020-10-18T17:54:30.000Z activated: 2020-10-18T17:54:30.000Z statusChanged: 2020-10-18T17:54:30.000Z lastLogin: null lastUpdated: 2020-10-18T17:56:53.000Z passwordChanged: null type: {“id”: “oty8zfz6plq7b0r830h7”} profile: {“firstName”: “John”, “lastName”: “Doe”, “mobilePhone”: null, “secondEmail”: null, “login”: “john.doe@example.com”, “email”: “john.doe@example.com”} credentials: {“provider”: {“type”: “Salesforce Fusion”, “name”: “Salesforce Fusion”}} |
iam-get-user
Retrieves a single user resource.
Base Command
iam-get-user
Input
| Argument Name | Description | Required |
|---|---|---|
| user-profile | The User Profile indicator. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| IAM.Vendor.active | Boolean | When true, indicates that the employee’s status is active in the 3rd-party integration. |
| IAM.Vendor.brand | String | Name of the integration. |
| IAM.Vendor.details | string | Provides the raw data from the 3rd-party integration. |
| IAM.Vendor.email | String | The employee’s email address. |
| IAM.Vendor.errorCode | Number | HTTP error response code. |
| IAM.Vendor.errorMessage | String | Reason why the API failed. |
| IAM.Vendor.id | String | The employee’s user ID in the app. |
| IAM.Vendor.instanceName | string | Name of the integration instance. |
| IAM.Vendor.success | Boolean | When true, indicates that the command was executed successfully. |
| IAM.Vendor.username | String | The employee’s username in the app. |
Command Example
!iam-get-user user-profile=`{\"email\": \"john.doe@example.com\"}`
Human Readable Output
Get User Results (Salesforce Fusion IAM)
| brand | instanceName | success | active | id | username | details | |
|---|---|---|---|---|---|---|---|
| Salesforce Fusion IAM | Salesforce Fusion IAM_instance_1 | true | true | 00uujxnbh3uJw4tWA0h7 | john.doe@example.com | john.doe@example.com | id: 00uujxnbh3uJw4tWA0h7 status: PROVISIONED created: 2020-10-18T17:54:30.000Z activated: 2020-10-18T17:54:30.000Z statusChanged: 2020-10-18T17:54:30.000Z lastLogin: null lastUpdated: 2020-10-18T17:56:53.000Z passwordChanged: null type: {“id”: “oty8zfz6plq7b0r830h7”} profile: {“firstName”: “John”, “lastName”: “Doe”, “mobilePhone”: null, “secondEmail”: null, “login”: “john.doe@example.com”, “email”: “john.doe@example.com”} credentials: {“provider”: {“type”: “Salesforce Fusion”, “name”: “Salesforce Fusion”}} |
iam-disable-user
Disable an active user.
Base Command
iam-disable-user
Input
| Argument Name | Description | Required |
|---|---|---|
| user-profile | The User Profile indicator. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| IAM.Vendor.active | Boolean | When true, indicates that the employee’s status is active in the 3rd-party integration. |
| IAM.Vendor.brand | String | Name of the integration. |
| IAM.Vendor.details | string | Provides the raw data from the 3rd-party integration. |
| IAM.Vendor.email | String | The employee’s email address. |
| IAM.Vendor.errorCode | Number | HTTP error response code. |
| IAM.Vendor.errorMessage | String | Reason why the API failed. |
| IAM.Vendor.id | String | The employee’s user ID in the app. |
| IAM.Vendor.instanceName | string | Name of the integration instance. |
| IAM.Vendor.success | Boolean | When true, indicates that the command was executed successfully. |
| IAM.Vendor.username | String | The employee’s username in the app. |
Command Example
!iam-disable-user user-profile={\"email\": \"john.doe@example.com\", \"givenname\": \"John\"}
Human Readable Output
Disable User Results (Salesforce Fusion IAM)
| brand | instanceName | success | active | id | username | details | |
|---|---|---|---|---|---|---|---|
| Salesforce Fusion IAM | Salesforce Fusion IAM_instance_1 | true | false | 00uujxnbh3uJw4tWA0h7 | john.doe@example.com | john.doe@example.com | id: 00uujxnbh3uJw4tWA0h7 status: PROVISIONED created: 2020-10-18T17:54:30.000Z activated: 2020-10-18T17:54:30.000Z statusChanged: 2020-10-18T17:54:30.000Z lastLogin: null lastUpdated: 2020-10-18T17:56:53.000Z passwordChanged: null type: {“id”: “oty8zfz6plq7b0r830h7”} profile: {“firstName”: “John”, “lastName”: “Doe”, “mobilePhone”: null, “secondEmail”: null, “login”: “john.doe@example.com”, “email”: “john.doe@example.com”} credentials: {“provider”: {“type”: “Salesforce Fusion”, “name”: “Salesforce Fusion”}} |
Configuration parameters
url— Base URL (required)credentials— User name (required)client_id— Client IDclient_secret— Client secretclient_id_creds— Client IDsecret_token— Secret tokensecret_token_creds—create_user_enabled— Allow creating usersupdate_user_enabled— Allow updating usersenable_user_enabled— Allow enabling usersdisable_user_enabled— Allow disabling userscreate_if_not_exists— Automatically create user if not found in update commandmapper_in— Incoming Mapper (required)mapper_out— Outgoing Mapperinsecure— Trust any certificate (not secure)proxy— Use system proxy settings
Commands (5)
-
get-mapping-fieldsRetrieves a User Profile schema, which holds all of the user fields within the application. Used for outgoing-mapping through the Get Schema option.
-
iam-create-userCreates a user.
-
iam-disable-userDisable an active user.
-
iam-get-userRetrieves a single user resource.
-
iam-update-userUpdates an existing user with the data passed in the user-profile argument.
import requests_mock from IAMApiModule import * from SalesforceFusionIAM import Client, main URI_PREFIX = "/services/data/v51.0/" APP_USER_OUTPUT = { "id": "mock_id", "Work_Email__c": "mock_user_name", "Name": "mock_user_name", "first_name": "mock_first_name", "last_name": "mock_last_name", "active": "true", "email": "testdemisto@paloaltonetworks.com", } APP_DISABLED_USER_OUTPUT = { "id": "mock_id", "Work_Email__c": "mock_user_name", "Name": "mock_user_name", "first_name": "mock_first_name", "last_name": "mock_last_name", "active": "false", "email": "testdemisto@paloaltonetworks.com", } APP_UPDATED_USER_OUTPUT = { "id": "mock_id", "Work_Email__c": "mock_update_user_name", "Name": "mock_update_user_name", "first_name": "mock_update_first_name", "last_name": "mock_update_last_name", "active": "false", "email": "testdemisto@paloaltonetworks.com", } def mock_client(): client = Client(base_url="https://test.com") return client def get_outputs_from_user_profile(user_profile): entry_context = user_profile.to_entry() outputs = entry_context.get("Contents") return outputs class TestSalesforceFusionIAM: def test_get_user_command__existing_user(self, mocker): """ Given: - An app client object - A user-profile argument that contains an email of a user When: - The user exists in the application - Calling function get_user_command Then: - Ensure the resulted User Profile object holds the correct user details """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com"}} mocker.patch.object(IAMUserProfile, "update_with_app_data", return_value={}) with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) m.get(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json=APP_USER_OUTPUT) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={"searchRecords": [{"Id": "mock_id"}]}, ) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).get_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.GET_USER assert outputs.get("success") is True assert outputs.get("active") is True assert outputs.get("id") == "mock_id" assert outputs.get("username") == "mock_user_name" assert outputs.get("details", {}).get("first_name") == "mock_first_name" assert outputs.get("details", {}).get("last_name") == "mock_last_name" def test_get_user_command__non_existing_user(self): """ Given: - An app client object - A user-profile argument that contains an email a user When: - The user does not exist in the application - Calling function get_user_command Then: - Ensure the resulted User Profile object holds information about an unsuccessful result. """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com"}} with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={}, ) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).get_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.GET_USER assert outputs.get("success") is False assert outputs.get("errorCode") == IAMErrors.USER_DOES_NOT_EXIST[0] assert outputs.get("errorMessage") == IAMErrors.USER_DOES_NOT_EXIST[1] def test_get_user_command__bad_response(self, mocker): """ Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: - Calling function get_user_command - A bad response (500) is returned from the application API Then: - Ensure the resulted User Profile object holds information about the bad response. """ import demistomock as demisto args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com"}} error_msg = {"detail": "something has gone wrong on the website's server", "message": "INTERNAL SERVER ERROR"} mocker.patch.object(demisto, "error") with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", status_code=500, json=error_msg, ) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).get_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.GET_USER assert outputs.get("success") is False assert outputs.get("errorCode") == 500 assert outputs.get("errorMessage") == "INTERNAL SERVER ERROR: something has gone wrong on the website's server" def test_create_user_command__success(self): """ Given: - An app client object - A user-profile argument that contains an email of a non-existing user in the application When: - Calling function create_user_command Then: - Ensure a User Profile object with the user data is returned """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com"}} with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) # User does not exist m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={}, ) # Create the user m.post(f"{URI_PREFIX}sobjects/FF__Key_Contact__c", json=APP_USER_OUTPUT) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).create_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.CREATE_USER assert outputs.get("success") is True assert outputs.get("active") is True assert outputs.get("id") == "mock_id" assert outputs.get("username") == "mock_user_name" assert outputs.get("details", {}).get("first_name") == "mock_first_name" assert outputs.get("details", {}).get("last_name") == "mock_last_name" def test_create_user_command__user_already_exists(self): """ Given: - An app client object - A user-profile argument that contains an email of a user When: - The user already exists in the application and disabled - allow-enable argument is false - Calling function create_user_command Then: - Ensure the command is considered successful and the user is still disabled """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com"}} with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) # User already exist m.get(f"https://test.com{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json=APP_UPDATED_USER_OUTPUT) m.post( f"https://test.com{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id?_HttpMethod=PATCH", json=APP_UPDATED_USER_OUTPUT ) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={"searchRecords": [{"Id": "mock_id"}]}, ) # Update the user m.post(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json={}) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).create_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.UPDATE_USER assert outputs.get("success") is True assert outputs.get("active") is True assert outputs.get("id") == "mock_id" # The updated user output assert outputs.get("username") == "mock_update_user_name" assert outputs.get("details", {}).get("first_name") == "mock_update_first_name" assert outputs.get("details", {}).get("last_name") == "mock_update_last_name" def test_update_user_command__non_existing_user(self): """ Given: - An app client object - A user-profile argument that contains user data When: - The user does not exist in the application - create-if-not-exists parameter is checked - Create User command is enabled - Calling function update_user_command Then: - Ensure the create action is executed - Ensure a User Profile object with the user data is returned """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com", "givenname": "mock_first_name"}} with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) # User does not exist m.get(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json={}) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={}, ) # The create user endpoint m.post(f"{URI_PREFIX}sobjects/FF__Key_Contact__c", json=APP_USER_OUTPUT) # The update user endpoint m.post(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json={}) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"], create_if_not_exists=True).update_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.CREATE_USER assert outputs.get("success") is True assert outputs.get("active") is True assert outputs.get("id") == "mock_id" assert outputs.get("username") == "mock_user_name" assert outputs.get("details", {}).get("first_name") == "mock_first_name" assert outputs.get("details", {}).get("last_name") == "mock_last_name" def test_update_user_command__command_is_disabled(self, mocker): """ Given: - An app client object - A user-profile argument that contains user data When: - Update User command is disabled - Calling function update_user_command Then: - Ensure the command is considered successful and skipped """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com", "givenname": "mock_first_name"}} with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"], is_update_enabled=False).update_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.UPDATE_USER assert outputs.get("success") is True assert outputs.get("skipped") is True assert outputs.get("reason") == "Command is disabled." def test_update_user_command__allow_enable(self): """ Given: - An app client object - A user-profile argument that contains user data When: - The user is disabled in the application - allow-enable argument is true - Calling function update_user_command Then: - Ensure the user is enabled at the end of the command execution. """ args = { "user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com", "givenname": "mock_first_name"}, "allow-enable": "true", } with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) m.get(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json=APP_UPDATED_USER_OUTPUT) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={"searchRecords": [{"Id": "mock_id"}]}, ) m.post(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json={}) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).update_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.UPDATE_USER assert outputs.get("success") is True assert outputs.get("active") is True assert outputs.get("id") == "mock_id" assert outputs.get("username") == "mock_update_user_name" assert outputs.get("details", {}).get("first_name") == "mock_update_first_name" assert outputs.get("details", {}).get("last_name") == "mock_update_last_name" def test_disable_user_command__non_existing_user(self): """ Given: - An app client object - A user-profile argument that contains an email of a user When: - create-if-not-exists parameter is unchecked - The user does not exist in the application - Calling function disable_user_command Then: - Ensure the command is considered successful and skipped """ args = {"user-profile": {"Work_Email__c": "testdemisto@paloaltonetworks.com"}} with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) # User does not exist m.get(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/mock_id", json={}) m.get( f"{URI_PREFIX}parameterizedSearch?q=testdemisto@paloaltonetworks.com&sobject=FF__Key_Contact__c" f"&FF__Key_Contact__c.where=Work_Email__c=%27testdemisto@paloaltonetworks.com%27" f"&FF__Key_Contact__c.fields=Id, FF__First_Name__c, FF__Last_Name__c, Work_Email__c, Name", json={"searchRecords": [{"Id": "mock_id"}]}, ) client = mock_client() user_profile = IAMCommand(get_user_iam_attrs=["Work_Email__c"]).disable_user(client, args) outputs = get_outputs_from_user_profile(user_profile) assert outputs.get("action") == IAMActions.DISABLE_USER assert outputs.get("success") is True assert outputs.get("skipped") is True assert outputs.get("reason") == IAMErrors.USER_DOES_NOT_EXIST[1] def test_get_mapping_fields_command__runs_the_all_integration_flow(self, mocker): """ Given: - An app client object When: - User schema in the application contains the fields 'field1' and 'field2' - Calling the main function with the get-mapping-fields command Then: - Ensure a GetMappingFieldsResponse object that contains the application fields is returned """ mocker.patch.object(demisto, "command", return_value="get-mapping-fields") mocker.patch.object(demisto, "params", return_value={"url": "https://test.com", "secret_token": "123456"}) mock_result = mocker.patch("SalesforceFusionIAM.return_results") schema = { "fields": [ {"name": "field1", "label": "desc1"}, {"name": "field2", "label": "desc2"}, ] } with requests_mock.Mocker() as m: m.post("https://test.com/services/oauth2/token?grant_type=password", json={}) m.get(f"{URI_PREFIX}sobjects/FF__Key_Contact__c/describe/", json=schema) main() mapping = mock_result.call_args.args[0].extract_mapping() assert mapping.get(IAMUserProfile.DEFAULT_INCIDENT_TYPE, {}).get("field1") == "desc1" assert mapping.get(IAMUserProfile.DEFAULT_INCIDENT_TYPE, {}).get("field2") == "desc2"