Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
72ce55c8
Commit
72ce55c8
authored
9 years ago
by
John Eskew
Browse files
Options
Downloads
Patches
Plain Diff
Convert to SharedModuleStoreTestCase
parent
8b287900
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/courseware/tests/test_navigation.py
+54
-44
54 additions, 44 deletions
lms/djangoapps/courseware/tests/test_navigation.py
with
54 additions
and
44 deletions
lms/djangoapps/courseware/tests/test_navigation.py
+
54
−
44
View file @
72ce55c8
...
...
@@ -11,56 +11,68 @@ from django.test.utils import override_settings
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.factories
import
GlobalStaffFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.django
import
modulestore
@attr
(
'
shard_1
'
)
class
TestNavigation
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestNavigation
(
Shared
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
Check that navigation state is saved properly.
"""
STUDENT_INFO
=
[(
'
view@test.com
'
,
'
foo
'
),
(
'
view2@test.com
'
,
'
foo
'
)]
def
setUp
(
self
):
super
(
TestNavigation
,
self
).
setUp
()
self
.
test_course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
chapter0
=
ItemFactory
.
create
(
parent
=
self
.
course
,
display_name
=
'
Overview
'
)
self
.
chapter9
=
ItemFactory
.
create
(
parent
=
self
.
course
,
display_name
=
'
factory_chapter
'
)
self
.
section0
=
ItemFactory
.
create
(
parent
=
self
.
chapter0
,
display_name
=
'
Welcome
'
)
self
.
section9
=
ItemFactory
.
create
(
parent
=
self
.
chapter9
,
display_name
=
'
factory_section
'
)
self
.
unit0
=
ItemFactory
.
create
(
parent
=
self
.
section0
,
display_name
=
'
New Unit
'
)
self
.
chapterchrome
=
ItemFactory
.
create
(
parent
=
self
.
course
,
display_name
=
'
Chrome
'
)
self
.
chromelesssection
=
ItemFactory
.
create
(
parent
=
self
.
chapterchrome
,
display_name
=
'
chromeless
'
,
chrome
=
'
none
'
)
self
.
accordionsection
=
ItemFactory
.
create
(
parent
=
self
.
chapterchrome
,
display_name
=
'
accordion
'
,
chrome
=
'
accordion
'
)
self
.
tabssection
=
ItemFactory
.
create
(
parent
=
self
.
chapterchrome
,
display_name
=
'
tabs
'
,
chrome
=
'
tabs
'
)
self
.
defaultchromesection
=
ItemFactory
.
create
(
parent
=
self
.
chapterchrome
,
@classmethod
def
setUpClass
(
cls
):
# pylint: disable=super-method-not-called
with
super
(
TestNavigation
,
cls
).
setUpClassAndTestData
():
cls
.
test_course
=
CourseFactory
.
create
()
cls
.
test_course_proctored
=
CourseFactory
.
create
()
cls
.
course
=
CourseFactory
.
create
()
@classmethod
def
setUpTestData
(
cls
):
cls
.
chapter0
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
display_name
=
'
Overview
'
)
cls
.
chapter9
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
display_name
=
'
factory_chapter
'
)
cls
.
section0
=
ItemFactory
.
create
(
parent
=
cls
.
chapter0
,
display_name
=
'
Welcome
'
)
cls
.
section9
=
ItemFactory
.
create
(
parent
=
cls
.
chapter9
,
display_name
=
'
factory_section
'
)
cls
.
unit0
=
ItemFactory
.
create
(
parent
=
cls
.
section0
,
display_name
=
'
New Unit
'
)
cls
.
chapterchrome
=
ItemFactory
.
create
(
parent
=
cls
.
course
,
display_name
=
'
Chrome
'
)
cls
.
chromelesssection
=
ItemFactory
.
create
(
parent
=
cls
.
chapterchrome
,
display_name
=
'
chromeless
'
,
chrome
=
'
none
'
)
cls
.
accordionsection
=
ItemFactory
.
create
(
parent
=
cls
.
chapterchrome
,
display_name
=
'
accordion
'
,
chrome
=
'
accordion
'
)
cls
.
tabssection
=
ItemFactory
.
create
(
parent
=
cls
.
chapterchrome
,
display_name
=
'
tabs
'
,
chrome
=
'
tabs
'
)
cls
.
defaultchromesection
=
ItemFactory
.
create
(
parent
=
cls
.
chapterchrome
,
display_name
=
'
defaultchrome
'
,
)
self
.
fullchromesection
=
ItemFactory
.
create
(
parent
=
self
.
chapterchrome
,
display_name
=
'
fullchrome
'
,
chrome
=
'
accordion,tabs
'
)
self
.
tabtest
=
ItemFactory
.
create
(
parent
=
self
.
chapterchrome
,
display_name
=
'
progress_tab
'
,
default_tab
=
'
progress
'
)
cls
.
fullchromesection
=
ItemFactory
.
create
(
parent
=
cls
.
chapterchrome
,
display_name
=
'
fullchrome
'
,
chrome
=
'
accordion,tabs
'
)
cls
.
tabtest
=
ItemFactory
.
create
(
parent
=
cls
.
chapterchrome
,
display_name
=
'
progress_tab
'
,
default_tab
=
'
progress
'
)
cls
.
staff_user
=
GlobalStaffFactory
()
cls
.
user
=
UserFactory
()
def
setUp
(
self
):
super
(
TestNavigation
,
self
).
setUp
()
# Create student accounts and activate them.
for
i
in
range
(
len
(
self
.
STUDENT_INFO
)):
...
...
@@ -69,8 +81,6 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
create_account
(
username
,
email
,
password
)
self
.
activate_user
(
email
)
self
.
staff_user
=
GlobalStaffFactory
()
def
assertTabActive
(
self
,
tabname
,
response
):
'''
Check if the progress tab is active in the tab set
'''
for
line
in
response
.
content
.
split
(
'
\n
'
):
...
...
@@ -278,9 +288,9 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
email
,
password
=
self
.
STUDENT_INFO
[
0
]
self
.
login
(
email
,
password
)
self
.
enroll
(
self
.
test_course
,
True
)
self
.
enroll
(
self
.
test_course
_proctored
,
True
)
test_course_id
=
self
.
test_course
.
id
.
to_deprecated_string
()
test_course_id
=
self
.
test_course
_proctored
.
id
.
to_deprecated_string
()
with
patch
.
dict
(
settings
.
FEATURES
,
{
'
ENABLE_SPECIAL_EXAMS
'
:
False
}):
url
=
reverse
(
...
...
@@ -302,10 +312,10 @@ class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
# now set up a course which is proctored enabled
self
.
test_course
.
enable_proctored_exams
=
True
self
.
test_course
.
save
()
self
.
test_course
_proctored
.
enable_proctored_exams
=
True
self
.
test_course
_proctored
.
save
()
modulestore
().
update_item
(
self
.
test_course
,
self
.
user
.
id
)
modulestore
().
update_item
(
self
.
test_course
_proctored
,
self
.
user
.
id
)
resp
=
self
.
client
.
get
(
url
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment