Skip to content

Commit

Permalink
Merge pull request openedx#430 from openedx/alangsto/deprecate_verifi…
Browse files Browse the repository at this point in the history
…cation_attempt_details

feat: deprecate unused verification attempt details code
  • Loading branch information
alangsto authored Sep 30, 2024
2 parents 25a0d32 + 2d07f5c commit 5ae8cec
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
16 changes: 0 additions & 16 deletions src/users/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
23 changes: 0 additions & 23 deletions src/users/data/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ describe('API', () => {
const testEmail = '[email protected]';
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}`;
Expand All @@ -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`;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions src/users/data/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down

0 comments on commit 5ae8cec

Please sign in to comment.