def test_upload_entries_update_remote_system_command(mocker): """ Given: - ServiceNow client - File and comment entries sent from XSOAR. When - running update_remote_system_command. Then - The checked entries was sent as expected with suffix. """ client = Client(server_url='https://server_url.com/', sc_server_url='sc_server_url', username='******', password='******', verify=False, fetch_time='fetch_time', sysparm_query='sysparm_query', sysparm_limit=10, timestamp_field='opened_at', ticket_type='incident', get_attachments=False, incident_name='description') params = {} args = { 'remoteId': '1234', 'data': {}, 'entries': MIRROR_ENTRIES, 'incidentChanged': False, 'delta': {} } mocker.patch.object(client, 'upload_file', side_effect=upload_file_request) mocker.patch.object(client, 'add_comment', side_effect=add_comment_request) update_remote_system_command(client, args, params)
def test_update_remote_data_sc_task(mocker): """ Given: - ServiceNow client - ServiceNow ticket of type sc_task When - running update_remote_system_command. Then - The state is changed to 3 (closed) after update. """ client = Client(server_url='https://server_url.com/', sc_server_url='sc_server_url', username='******', password='******', verify=False, fetch_time='fetch_time', sysparm_query='sysparm_query', sysparm_limit=10, timestamp_field='opened_at', ticket_type='sc_task', get_attachments=False, incident_name='description') params = {'ticket_type': 'sc_task', 'close_ticket': True} args = { 'remoteId': '1234', 'data': TICKET_FIELDS, 'entries': [], 'incidentChanged': True, 'delta': {}, 'status': 2 } mocker.patch('ServiceNowv2.get_ticket_fields', side_effect=ticket_fields) mocker.patch.object(client, 'update', side_effect=update_ticket) update_remote_system_command(client, args, params)