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
74839663
Commit
74839663
authored
Jan 29, 2013
by
Deena Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added cms/djangoapps/contentstore/test/tests.py
parent
7918c354
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
cms/djangoapps/contentstore/tests/test_views.py
+50
-0
No files found.
cms/djangoapps/contentstore/tests/test_views.py
0 → 100644
View file @
74839663
import
logging
from
mock
import
MagicMock
,
patch
import
json
import
factory
import
unittest
from
nose.tools
import
set_trace
from
nose.plugins.skip
import
SkipTest
from
django.http
import
Http404
,
HttpResponse
,
HttpRequest
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test.client
import
Client
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test.client
import
RequestFactory
import
cms.djangoapps.contentstore.views
as
views
def
xml_store_config
(
data_dir
):
return
{
'default'
:
{
'ENGINE'
:
'xmodule.modulestore.xml.XMLModuleStore'
,
'OPTIONS'
:
{
'data_dir'
:
data_dir
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
}
}
}
class
UserFactory
(
factory
.
Factory
):
first_name
=
'Test'
last_name
=
'Robot'
is_staff
=
True
is_active
=
True
is_authenticated
=
True
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
TEST_DATA_XML_MODULESTORE
=
xml_store_config
(
TEST_DATA_DIR
)
@override_settings
(
MODULESTORE
=
TEST_DATA_XML_MODULESTORE
)
class
ViewsTestCase
(
TestCase
):
def
setUp
(
self
):
self
.
location
=
[
'i4x'
,
'edX'
,
'toy'
,
'chapter'
,
'Overview'
]
self
.
_MODULESTORES
=
{}
self
.
course_id
=
'edX/toy/2012_Fall'
self
.
toy_course
=
modulestore
()
.
get_course
(
self
.
course_id
)
def
test_has_access
(
self
):
user
=
UserFactory
()
views
.
has_access
(
user
,
self
.
location
)
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