def test_cancel_restore_calls_delete_with_correct_url( self, mocker, session): storage_archive_client = StorageArchiveClient(session) api_response = mocker.MagicMock(spec=Py42Response) session.delete.return_value = api_response storage_archive_client.cancel_restore(WEB_RESTORE_JOB_ID) session.delete.assert_called_once_with(WEB_RESTORE_JOB_URL, json=mocker.ANY)
def test_cancel_restore_calls_delete_with_job_id_in_data( self, mocker, session): storage_archive_client = StorageArchiveClient(session) api_response = mocker.MagicMock(spec=Py42Response) text = json.dumps({JOB_ID_KEY: WEB_RESTORE_JOB_ID}) session.delete.return_value = api_response storage_archive_client.cancel_restore(WEB_RESTORE_JOB_ID) json_arg = session.delete.call_args[KWARGS_INDEX][JSON_KEYWORD] expected_data = {JOB_ID_KEY: WEB_RESTORE_JOB_ID} assert json_arg == expected_data