Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
edx-proctoring
Commits
f004c530
Commit
f004c530
authored
Jul 16, 2015
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose a is_feature_enabled() method
parent
34cd882f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletions
+25
-1
edx_proctoring/api.py
+8
-0
edx_proctoring/tests/test_api.py
+16
-1
settings.py
+1
-0
No files found.
edx_proctoring/api.py
View file @
f004c530
...
@@ -35,6 +35,14 @@ from edx_proctoring.utils import humanized_time
...
@@ -35,6 +35,14 @@ from edx_proctoring.utils import humanized_time
from
edx_proctoring.backends
import
get_backend_provider
from
edx_proctoring.backends
import
get_backend_provider
def
is_feature_enabled
():
"""
Returns if this feature has been enabled in our FEATURE flags
"""
return
hasattr
(
settings
,
'FEATURES'
)
and
settings
.
FEATURES
.
get
(
'ENABLE_PROCTORED_EXAMS'
,
False
)
def
create_exam
(
course_id
,
content_id
,
exam_name
,
time_limit_mins
,
def
create_exam
(
course_id
,
content_id
,
exam_name
,
time_limit_mins
,
is_proctored
=
True
,
external_id
=
None
,
is_active
=
True
):
is_proctored
=
True
,
external_id
=
None
,
is_active
=
True
):
"""
"""
...
...
edx_proctoring/tests/test_api.py
View file @
f004c530
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
All tests for the models.py
All tests for the models.py
"""
"""
from
datetime
import
datetime
from
datetime
import
datetime
from
mock
import
patch
import
pytz
import
pytz
...
@@ -24,7 +25,9 @@ from edx_proctoring.api import (
...
@@ -24,7 +25,9 @@ from edx_proctoring.api import (
get_exam_attempt_by_id
,
get_exam_attempt_by_id
,
remove_exam_attempt_by_id
,
remove_exam_attempt_by_id
,
get_all_exam_attempts
,
get_all_exam_attempts
,
get_filtered_exam_attempts
)
get_filtered_exam_attempts
,
is_feature_enabled
,
)
from
edx_proctoring.exceptions
import
(
from
edx_proctoring.exceptions
import
(
ProctoredExamAlreadyExists
,
ProctoredExamAlreadyExists
,
ProctoredExamNotFoundException
,
ProctoredExamNotFoundException
,
...
@@ -126,6 +129,18 @@ class ProctoredExamApiTests(LoggedInTestCase):
...
@@ -126,6 +129,18 @@ class ProctoredExamApiTests(LoggedInTestCase):
proctored_exam_id
=
self
.
proctored_exam_id
,
user_id
=
self
.
user_id
,
key
=
self
.
key
,
value
=
self
.
value
proctored_exam_id
=
self
.
proctored_exam_id
,
user_id
=
self
.
user_id
,
key
=
self
.
key
,
value
=
self
.
value
)
)
def
test_feature_enabled
(
self
):
"""
Checks the is_feature_enabled method
"""
self
.
assertFalse
(
is_feature_enabled
())
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'ENABLE_PROCTORED_EXAMS'
:
False
}):
self
.
assertFalse
(
is_feature_enabled
())
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'ENABLE_PROCTORED_EXAMS'
:
True
}):
self
.
assertTrue
(
is_feature_enabled
())
def
test_create_duplicate_exam
(
self
):
def
test_create_duplicate_exam
(
self
):
"""
"""
Test to create a proctored exam that has already exist in the
Test to create a proctored exam that has already exist in the
...
...
settings.py
View file @
f004c530
...
@@ -17,6 +17,7 @@ USE_TZ = True
...
@@ -17,6 +17,7 @@ USE_TZ = True
TIME_ZONE
=
{}
TIME_ZONE
=
{}
SECRET_KEY
=
'SHHHHHH'
SECRET_KEY
=
'SHHHHHH'
PLATFORM_NAME
=
'Open edX'
PLATFORM_NAME
=
'Open edX'
FEATURES
=
{}
DATABASES
=
{
DATABASES
=
{
'default'
:
{
'default'
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment