Skip to content

Commit

Permalink
feat: remove use of proctoring settings and use config values (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
alangsto authored Apr 5, 2023
1 parent b35792c commit a37b9fa
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 121 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
NODE_ENV='production'
LANGUAGE_PREFERENCE_COOKIE_NAME=null
LMS_BASE_URL=null
CONTACT_URL=''
PROCTORED_EXAM_FAQ_URL=''
PROCTORED_EXAM_RULES_URL=''
3 changes: 3 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
NODE_ENV='development'
LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference'
LMS_BASE_URL='http://localhost:18000'
CONTACT_URL='http://localhost:18000/contact'
PROCTORED_EXAM_FAQ_URL=''
PROCTORED_EXAM_RULES_URL=''
3 changes: 3 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference'
LMS_BASE_URL='http://localhost:18000'
EXAMS_BASE_URL='http://localhost:18740'
CONTACT_URL='http://localhost:18000/contact'
PROCTORED_EXAM_FAQ_URL=''
PROCTORED_EXAM_RULES_URL=''
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coverage:
project:
default:
target: auto
threshold: 0%
threshold: 0.2%
patch:
default:
target: auto
Expand Down
8 changes: 0 additions & 8 deletions src/data/__factories__/proctoringSettings.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ import { Factory } from 'rosie'; // eslint-disable-line import/no-extraneous-dep

Factory.define('proctoringSettings')
.attrs({
platform_name: 'Your Platform Name Here',
contact_us: '[email protected]',
link_urls: {
contact_us: 'https://example.com/contact_us/',
faq: 'https://example.com/faq/',
online_proctoring_rules: 'https://example.com/online_proctoring_rules/',
tech_requirements: 'https://example.com/tech_requirements/',
},
exam_proctoring_backend: {
download_url: '',
instructions: [],
Expand Down
26 changes: 0 additions & 26 deletions src/data/__snapshots__/redux.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ Object {
},
"isLoading": false,
"proctoringSettings": Object {
"contact_us": "",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -84,8 +83,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": null,
"platform_name": "",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand Down Expand Up @@ -124,7 +121,6 @@ Object {
},
"isLoading": false,
"proctoringSettings": Object {
"contact_us": "",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -133,8 +129,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": null,
"platform_name": "",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand Down Expand Up @@ -212,7 +206,6 @@ Object {
},
"isLoading": false,
"proctoringSettings": Object {
"contact_us": "",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -221,8 +214,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": null,
"platform_name": "",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand Down Expand Up @@ -261,7 +252,6 @@ Object {
},
"isLoading": false,
"proctoringSettings": Object {
"contact_us": "",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -270,8 +260,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": null,
"platform_name": "",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand All @@ -283,7 +271,6 @@ Object {

exports[`Data layer integration tests Test getProctoringSettings Should fail to fetch if error occurs 1`] = `
Object {
"contact_us": "",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -292,8 +279,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": null,
"platform_name": "",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand All @@ -302,7 +287,6 @@ Object {

exports[`Data layer integration tests Test getProctoringSettings Should get, and save proctoringSettings 1`] = `
Object {
"contact_us": "[email protected]",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -311,13 +295,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": Object {
"contact_us": "https://example.com/contact_us/",
"faq": "https://example.com/faq/",
"online_proctoring_rules": "https://example.com/online_proctoring_rules/",
"tech_requirements": "https://example.com/tech_requirements/",
},
"platform_name": "Your Platform Name Here",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand Down Expand Up @@ -416,7 +393,6 @@ Object {
},
"isLoading": false,
"proctoringSettings": Object {
"contact_us": "",
"exam_proctoring_backend": Object {
"download_url": "",
"instructions": Array [],
Expand All @@ -425,8 +401,6 @@ Object {
},
"integration_specific_email": "",
"learner_notification_from_email": "",
"link_urls": null,
"platform_name": "",
"provider_name": "",
"provider_tech_support_email": "",
"provider_tech_support_phone": "",
Expand Down
3 changes: 0 additions & 3 deletions src/data/slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ export const examSlice = createSlice({
activeAttempt: null, // has the same structure as attempt in exam object
allowProctoringOptOut: false,
proctoringSettings: {
platform_name: '',
contact_us: '',
link_urls: null,
exam_proctoring_backend: {
download_url: '',
instructions: [],
Expand Down
8 changes: 5 additions & 3 deletions src/exam/Exam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ const Exam = ({
const proctoredExamTypes = [ExamType.ONBOARDING, ExamType.PRACTICE, ExamType.PROCTORED];

useEffect(() => {
if (examId) {
getProctoringSettings();
}
if (proctoredExamTypes.includes(examType)) {
// only fetch proctoring settings for a proctored exam
if (examId) {
getProctoringSettings();
}

// Only exclude Timed Exam when restricting access to exams
setHasProctoredExamAccess(canAccessProctoredExams);
}
Expand Down
58 changes: 0 additions & 58 deletions src/instructions/Instructions.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ describe('SequenceExamWrapper', () => {
examState: Factory.build('examState', {
timeIsOver: true,
allowProctoringOptOut: true,
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
exam: Factory.build('exam', {
is_proctored: true,
attempt: {},
Expand Down Expand Up @@ -178,9 +175,6 @@ describe('SequenceExamWrapper', () => {
store.getState = () => ({
examState: Factory.build('examState', {
timeIsOver: true,
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
exam: Factory.build('exam', {
is_proctored: true,
type: ExamType.PROCTORED,
Expand Down Expand Up @@ -214,13 +208,6 @@ describe('SequenceExamWrapper', () => {
store.getState = () => ({
examState: Factory.build('examState', {
timeIsOver: true,
proctoringSettings: Factory.build('proctoringSettings', {
link_urls: [
{
contact_us: 'http://localhost:2000',
},
],
}),
exam: Factory.build('exam', {
type: ExamType.PROCTORED,
attempt: Factory.build('attempt', {
Expand All @@ -245,9 +232,6 @@ describe('SequenceExamWrapper', () => {
store.getState = () => ({
examState: Factory.build('examState', {
timeIsOver: true,
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Platform Name',
}),
exam: Factory.build('exam', {
type: ExamType.PROCTORED,
attempt: Factory.build('attempt', {
Expand Down Expand Up @@ -359,7 +343,6 @@ describe('SequenceExamWrapper', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
integration_specific_email: integrationEmail,
}),
exam: Factory.build('exam', {
Expand Down Expand Up @@ -394,9 +377,6 @@ describe('SequenceExamWrapper', () => {
it('Shows submit onboarding exam instructions if exam is onboarding and attempt status is ready_to_submit', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand All @@ -423,9 +403,6 @@ describe('SequenceExamWrapper', () => {
it('Shows error onboarding exam instructions if exam is onboarding and attempt status is error', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down Expand Up @@ -454,7 +431,6 @@ describe('SequenceExamWrapper', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
integration_specific_email: '[email protected]',
learner_notification_from_email: '[email protected]',
}),
Expand Down Expand Up @@ -493,7 +469,6 @@ describe('SequenceExamWrapper', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
integration_specific_email: '[email protected]',
}),
activeAttempt: {},
Expand Down Expand Up @@ -523,9 +498,6 @@ describe('SequenceExamWrapper', () => {
it('Shows error practice exam instructions if exam is onboarding and attempt status is error', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down Expand Up @@ -553,9 +525,6 @@ describe('SequenceExamWrapper', () => {
it('Shows submitted practice exam instructions if exam is onboarding and attempt status is submitted', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down Expand Up @@ -583,9 +552,6 @@ describe('SequenceExamWrapper', () => {
it('Does not show expired page if exam is passed due date and is practice', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand All @@ -610,9 +576,6 @@ describe('SequenceExamWrapper', () => {
it.each([ExamType.TIMED, ExamType.PROCTORED, ExamType.ONBOARDING])('Shows expired page when exam is passed due date and is %s', (examType) => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down Expand Up @@ -640,9 +603,6 @@ describe('SequenceExamWrapper', () => {
(item) => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down Expand Up @@ -672,9 +632,6 @@ describe('SequenceExamWrapper', () => {
it('Shows exam content for timed exam if attempt status is submitted, due date has passed and hide after due is set to false', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
type: ExamType.TIMED,
Expand Down Expand Up @@ -702,9 +659,6 @@ describe('SequenceExamWrapper', () => {
it('Shows submitted exam page for proctored exams if attempt status is submitted, due date has passed and hide after due is set to false', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
type: ExamType.PROCTORED,
Expand Down Expand Up @@ -732,9 +686,6 @@ describe('SequenceExamWrapper', () => {
it('Shows submitted page when proctored exam is in second_review_required status', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down Expand Up @@ -807,9 +758,6 @@ describe('SequenceExamWrapper', () => {
it('Shows error message if receives unknown attempt status', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
type: ExamType.TIMED,
Expand All @@ -835,9 +783,6 @@ describe('SequenceExamWrapper', () => {
it('Shows ready to start page when proctored exam is in ready_to_start status', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand All @@ -864,9 +809,6 @@ describe('SequenceExamWrapper', () => {
it('Shows loading spinner while waiting to start exam', () => {
store.getState = () => ({
examState: Factory.build('examState', {
proctoringSettings: Factory.build('proctoringSettings', {
platform_name: 'Your Platform',
}),
activeAttempt: {},
exam: Factory.build('exam', {
is_proctored: true,
Expand Down
Loading

0 comments on commit a37b9fa

Please sign in to comment.