Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
64ff890f
Commit
64ff890f
authored
Jul 01, 2015
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable ORA 1 tabs in LMS if combinedopeneded is disabled in LMS.
TNL-2305
parent
fe54b085
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletions
+47
-1
lms/djangoapps/open_ended_grading/tests.py
+40
-1
lms/djangoapps/open_ended_grading/views.py
+7
-0
No files found.
lms/djangoapps/open_ended_grading/tests.py
View file @
64ff890f
...
...
@@ -3,7 +3,7 @@ Tests for open ended grading interfaces
./manage.py lms --settings test test lms/djangoapps/open_ended_grading
"""
import
ddt
import
json
import
logging
...
...
@@ -18,15 +18,18 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from
xblock.field_data
import
DictFieldData
from
xblock.fields
import
ScopeIds
from
config_models.models
import
cache
from
courseware.tests
import
factories
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
lms.djangoapps.lms_xblock.runtime
import
LmsModuleSystem
from
student.roles
import
CourseStaffRole
from
student.models
import
unique_id_for_user
from
xblock_django.models
import
XBlockDisableConfig
from
xmodule
import
peer_grading_module
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
TEST_DATA_MIXED_TOY_MODULESTORE
,
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
from
xmodule.open_ended_grading_classes
import
peer_grading_service
,
controller_query_service
from
xmodule.tests
import
test_util_open_ended
...
...
@@ -547,3 +550,39 @@ class TestStudentProblemList(ModuleStoreTestCase):
self
.
assertEqual
(
len
(
valid_problems
),
2
)
# Ensure that human names are being set properly.
self
.
assertEqual
(
valid_problems
[
0
][
'grader_type_display_name'
],
"Instructor Assessment"
)
@ddt.ddt
class
TestTabs
(
ModuleStoreTestCase
):
"""
Test tabs.
"""
def
setUp
(
self
):
super
(
TestTabs
,
self
)
.
setUp
()
self
.
course
=
CourseFactory
(
advanced_modules
=
(
'combinedopenended'
))
self
.
addCleanup
(
lambda
:
self
.
_enable_xblock_disable_config
(
False
))
def
_enable_xblock_disable_config
(
self
,
enabled
):
""" Enable or disable xblocks disable. """
config
=
XBlockDisableConfig
.
current
()
config
.
enabled
=
enabled
config
.
disabled_blocks
=
"
\n
"
.
join
((
'combinedopenended'
,
'peergrading'
))
config
.
save
()
cache
.
clear
()
@ddt.data
(
views
.
StaffGradingTab
,
views
.
PeerGradingTab
,
views
.
OpenEndedGradingTab
,
)
def
test_tabs_enabled
(
self
,
tab
):
self
.
assertTrue
(
tab
.
is_enabled
(
self
.
course
))
@ddt.data
(
views
.
StaffGradingTab
,
views
.
PeerGradingTab
,
views
.
OpenEndedGradingTab
,
)
def
test_tabs_disabled
(
self
,
tab
):
self
.
_enable_xblock_disable_config
(
True
)
self
.
assertFalse
(
tab
.
is_enabled
(
self
.
course
))
lms/djangoapps/open_ended_grading/views.py
View file @
64ff890f
...
...
@@ -26,6 +26,7 @@ from django.utils.translation import ugettext as _
from
open_ended_grading.utils
import
(
STAFF_ERROR_MESSAGE
,
StudentProblemList
,
generate_problem_url
,
create_controller_query_service
)
from
xblock_django.models
import
XBlockDisableConfig
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -75,6 +76,8 @@ class StaffGradingTab(EnrolledTab):
@classmethod
def
is_enabled
(
cls
,
course
,
user
=
None
):
# pylint: disable=unused-argument
if
XBlockDisableConfig
.
is_block_type_disabled
(
'combinedopenended'
):
return
False
if
user
and
not
has_access
(
user
,
'staff'
,
course
,
course
.
id
):
return
False
return
"combinedopenended"
in
course
.
advanced_modules
...
...
@@ -92,6 +95,8 @@ class PeerGradingTab(EnrolledTab):
@classmethod
def
is_enabled
(
cls
,
course
,
user
=
None
):
# pylint: disable=unused-argument
if
XBlockDisableConfig
.
is_block_type_disabled
(
'combinedopenended'
):
return
False
if
not
super
(
PeerGradingTab
,
cls
)
.
is_enabled
(
course
,
user
=
user
):
return
False
return
"combinedopenended"
in
course
.
advanced_modules
...
...
@@ -109,6 +114,8 @@ class OpenEndedGradingTab(EnrolledTab):
@classmethod
def
is_enabled
(
cls
,
course
,
user
=
None
):
# pylint: disable=unused-argument
if
XBlockDisableConfig
.
is_block_type_disabled
(
'combinedopenended'
):
return
False
if
not
super
(
OpenEndedGradingTab
,
cls
)
.
is_enabled
(
course
,
user
=
user
):
return
False
return
"combinedopenended"
in
course
.
advanced_modules
...
...
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