From 2d07f5ce6ce34050e0dd891b4cd97005d05352ee Mon Sep 17 00:00:00 2001 From: Alie Langston Date: Mon, 30 Sep 2024 10:48:51 -0400 Subject: [PATCH] feat: deprecate unused verification attempt details code --- src/users/data/api.js | 16 ---------------- src/users/data/api.test.js | 23 ----------------------- src/users/data/urls.js | 4 ---- 3 files changed, 43 deletions(-) diff --git a/src/users/data/api.js b/src/users/data/api.js index 7a5eddd3c..3466bc184 100644 --- a/src/users/data/api.js +++ b/src/users/data/api.js @@ -261,22 +261,6 @@ export async function getVerifiedNameHistory(username) { } } -export async function getVerificationAttemptDetailsById(attemptId) { - try { - const { data } = await getAuthenticatedHttpClient().get( - AppUrls.getVerificationAttemptDetailsByIdUrl(attemptId), - ); - return data; - } catch (error) { - // We don't have good error handling in the app for any errors that may have come back - // from the API, so we log them to the console and tell the user to go look. We would - // never do this in a customer-facing app. - // eslint-disable-next-line no-console - console.log(JSON.parse(error.customAttributes.httpErrorResponseData)); - return {}; - } -} - export async function getUserPasswordStatus(userIdentifier) { const { data } = await getAuthenticatedHttpClient().get( AppUrls.getUserPasswordStatusUrl(userIdentifier), diff --git a/src/users/data/api.test.js b/src/users/data/api.test.js index ec5c5ba31..9ecaae9ca 100644 --- a/src/users/data/api.test.js +++ b/src/users/data/api.test.js @@ -17,7 +17,6 @@ describe('API', () => { const testEmail = 'email@example.com'; const testLMSUserID = '22'; const testCourseId = 'course-v1:testX+test123+2030'; - const testAttemptId = 12334; const userAccountApiBaseUrl = `${getConfig().LMS_BASE_URL}/api/user/v1/accounts`; const ssoRecordsApiUrl = `${getConfig().LMS_BASE_URL}/support/sso_records/${testUsername}`; const enrollmentsApiUrl = `${getConfig().LMS_BASE_URL}/support/enrollment/${testUsername}`; @@ -26,7 +25,6 @@ describe('API', () => { const verificationDetailsApiUrl = `${getConfig().LMS_BASE_URL}/api/user/v1/accounts/${testUsername}/verifications/`; const verificationStatusApiUrl = `${getConfig().LMS_BASE_URL}/api/user/v1/accounts/${testUsername}/verification_status/`; const verifiedNameHistoryUrl = `${getConfig().LMS_BASE_URL}/api/edx_name_affirmation/v1/verified_name/history?username=${testUsername}`; - const verificationAttemptDetailsByIdUrl = `${getConfig().LMS_BASE_URL}/api/user/v1/accounts/verifications/${testAttemptId}/`; const licensesApiUrl = `${getConfig().LICENSE_MANAGER_URL}/api/v1/staff_lookup_licenses/`; const certificatesUrl = urls.getCertificateUrl(testUsername, testCourseId); const credentialUrl = `${getConfig().CREDENTIALS_BASE_URL}/api/v2/credentials`; @@ -331,27 +329,6 @@ describe('API', () => { }); }); - describe('Verification Attempt Details By Id', () => { - const mockResponse = { - message: '[{"generalReasons": ["Name mismatch"]}]', - status: 'denied', - verificationType: 'softwareSecure', - }; - - it('returns empty if request experience server error', async () => { - mockAdapter.onGet(verificationAttemptDetailsByIdUrl).reply(() => throwError(500, '{}')); - const response = await api.getVerificationAttemptDetailsById(testAttemptId); - expect(response).toEqual({}); - }); - - it('successfully fetches data', async () => { - mockAdapter.onGet(verificationAttemptDetailsByIdUrl).reply(200, mockResponse); - - const response = await api.getVerificationAttemptDetailsById(testAttemptId); - expect(response).toEqual(mockResponse); - }); - }); - describe('User Account Details', () => { const successDictResponse = { username: testUsername, diff --git a/src/users/data/urls.js b/src/users/data/urls.js index ea63a5d29..5ab6bd02b 100644 --- a/src/users/data/urls.js +++ b/src/users/data/urls.js @@ -47,10 +47,6 @@ export const getVerifiedNameHistoryUrl = username => `${ LMS_BASE_URL }/api/edx_name_affirmation/v1/verified_name/history?username=${username}`; -export const getVerificationAttemptDetailsByIdUrl = attemptId => `${ - LMS_BASE_URL -}/api/user/v1/accounts/verifications/${attemptId}/`; - export const getUserPasswordStatusUrl = userIdentifier => `${ LMS_BASE_URL }/support/manage_user/${userIdentifier}`;