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
38583621
Commit
38583621
authored
Jan 29, 2013
by
Deena Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tests
parent
4f58e9c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
cms/djangoapps/contentstore/tests/test_views.py
+10
-5
No files found.
cms/djangoapps/contentstore/tests/test_views.py
View file @
38583621
...
@@ -50,8 +50,14 @@ class ViewsTestCase(TestCase):
...
@@ -50,8 +50,14 @@ class ViewsTestCase(TestCase):
self
.
_MODULESTORES
=
{}
self
.
_MODULESTORES
=
{}
self
.
course_id
=
'edX/toy/2012_Fall'
self
.
course_id
=
'edX/toy/2012_Fall'
self
.
course_id_2
=
'edx/full/6.002_Spring_2012'
self
.
course_id_2
=
'edx/full/6.002_Spring_2012'
self
.
toy_course
=
modulestore
()
.
get_course
(
self
.
course_id
)
#self.toy_course = modulestore().get_course(self.course_id)
# Problem: Classes persist, need to delete stuff from modulestore
self
.
course
=
CourseFactory
.
create
()
print
dir
(
self
.
course
)
def
tearDown
(
self
):
pass
def
test_has_access
(
self
):
def
test_has_access
(
self
):
user
=
MagicMock
(
is_staff
=
True
,
is_active
=
True
,
is_authenticated
=
True
)
user
=
MagicMock
(
is_staff
=
True
,
is_active
=
True
,
is_authenticated
=
True
)
m
=
MagicMock
()
m
=
MagicMock
()
...
@@ -72,16 +78,15 @@ class ViewsTestCase(TestCase):
...
@@ -72,16 +78,15 @@ class ViewsTestCase(TestCase):
self
.
user_2
=
MagicMock
(
is_staff
=
True
,
is_active
=
True
)
self
.
user_2
=
MagicMock
(
is_staff
=
True
,
is_active
=
True
)
self
.
user_2
.
is_authenticated
.
return_value
=
True
self
.
user_2
.
is_authenticated
.
return_value
=
True
request_2
=
MagicMock
(
user
=
self
.
user_2
)
request_2
=
MagicMock
(
user
=
self
.
user_2
)
# Bug? Raises error because calls modulestore().get_item(location)
# Need to use XModuleStoreFactory?
#NotImplementedError: XMLModuleStores can't guarantee that definitions
#are unique. Use get_instance.
print
views
.
course_index
(
request_2
,
'edX'
,
print
views
.
course_index
(
request_2
,
'edX'
,
'full'
,
'6.002_Spring_2012'
)
'full'
,
'6.002_Spring_2012'
)
def
test_edit_subsection
(
self
):
def
test_edit_subsection
(
self
):
# Redirects if request.user doesn't have access to location
self
.
user
=
MagicMock
(
is_staff
=
False
,
is_active
=
False
)
self
.
user
=
MagicMock
(
is_staff
=
False
,
is_active
=
False
)
self
.
user
.
is_authenticated
.
return_value
=
False
self
.
user
.
is_authenticated
.
return_value
=
False
self
.
request
=
MagicMock
(
user
=
self
.
user
)
self
.
request
=
MagicMock
(
user
=
self
.
user
)
self
.
assertIsInstance
(
views
.
edit_subs
crip
tion
(
self
.
request
,
self
.
location_2
),
self
.
assertIsInstance
(
views
.
edit_subs
ec
tion
(
self
.
request
,
self
.
location_2
),
HttpResponseRedirect
)
HttpResponseRedirect
)
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