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
ddcd166b
Commit
ddcd166b
authored
Oct 07, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make tests pass without LMS settings
parent
9e436644
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
common/djangoapps/status/tests.py
+16
-14
No files found.
common/djangoapps/status/tests.py
View file @
ddcd166b
from
django.conf
import
settings
from
django.test
import
TestCase
from
tempfile
import
NamedTemporaryFile
from
mock
import
Mock
import
os
from
override_settings
import
override_settings
from
tempfile
import
NamedTemporaryFile
from
status
import
get_site_status_msg
import
xmodule.modulestore.django
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.xml_importer
import
import_from_xml
# Get a name where we can put test files
TMP_FILE
=
NamedTemporaryFile
(
delete
=
False
)
TMP_NAME
=
TMP_FILE
.
name
# Close it--we just want the path.
TMP_FILE
.
close
()
@override_settings
(
STATUS_MESSAGE_PATH
=
TMP_NAME
)
class
TestStatus
(
TestCase
):
"""Test that the get_site_status_msg function does the right thing"""
...
...
@@ -49,15 +52,14 @@ class TestStatus(TestCase):
]
def
setUp
(
self
):
xmodule
.
modulestore
.
django
.
_MODULESTORES
=
{}
courses
=
modulestore
()
.
get_courses
()
def
find_course
(
course_id
):
"""Assumes the course is present"""
return
[
c
for
c
in
courses
if
c
.
id
==
course_id
][
0
]
self
.
full
=
find_course
(
"edX/full/6.002_Spring_2012"
)
self
.
toy
=
find_course
(
"edX/toy/2012_Fall"
)
"""
Mock courses, since we don't have to have full django
settings (common tests run without the lms settings imported)
"""
self
.
full
=
Mock
()
self
.
full
.
id
=
'edX/full/2012_Fall'
self
.
toy
=
Mock
()
self
.
toy
.
id
=
'edX/toy/2012_Fall'
def
create_status_file
(
self
,
contents
):
"""
...
...
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