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
6e773909
Commit
6e773909
authored
Jan 22, 2013
by
Deena Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test_views
parent
1565cd5b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
lms/djangoapps/courseware/tests/test_module_render.py
+2
-2
lms/djangoapps/courseware/tests/test_views.py
+37
-0
No files found.
lms/djangoapps/courseware/tests/test_module_render.py
View file @
6e773909
...
...
@@ -71,8 +71,6 @@ class ModuleRenderTestCase(TestCase):
self
.
assertIsInstance
(
render
.
get_shared_instance_module
(
'dummy'
,
mock_user
,
mock_module
,
'dummy'
),
StudentModule
)
def
test_xqueue_callback
(
self
):
mock_request
=
MagicMock
()
mock_request
.
POST
.
copy
.
return_value
=
{}
...
...
@@ -162,3 +160,5 @@ class ModuleRenderTestCase(TestCase):
class
MagicMockFactory
(
factory
.
Factory
):
FACTORY_FOR
=
MagicMock
v
=
factory
.
LazyAttribute
(
i
for
i
in
[
True
,
False
,
False
])
lms/djangoapps/courseware/tests/test_views.py
0 → 100644
View file @
6e773909
from
unittest
import
TestCase
import
logging
from
mock
import
MagicMock
,
patch
from
django.conf
import
settings
from
django.test.utils
import
override_settings
import
courseware.views
as
views
class
Stub
():
pass
class
ViewsTestCase
(
TestCase
):
def
setUp
(
self
):
pass
def
test_user_groups
(
self
):
mock_user
=
MagicMock
()
mock_user
.
is_authenticated
.
return_value
=
False
self
.
assertEquals
(
views
.
user_groups
(
mock_user
),[])
@override_settings
(
DEBUG
=
True
)
def
test_user_groups_debug
(
self
):
mock_user
=
MagicMock
()
mock_user
.
is_authenticated
.
return_value
=
True
pass
#views.user_groups(mock_user)
#Keep going later
def
test_get_current_child
(
self
):
self
.
assertIsNone
(
views
.
get_current_child
(
Stub
()))
mock_xmodule
=
MagicMock
()
mock_xmodule
.
position
=
-
1
mock_xmodule
.
get_display_items
.
return_value
=
[
'one'
,
'two'
]
print
views
.
user_groups
(
mock_xmodule
)
self
.
assertEquals
(
views
.
user_groups
(
mock_xmodule
),
'one'
)
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