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
7668ef6f
Commit
7668ef6f
authored
Sep 12, 2013
by
Jason Bau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug with anonymous access to / with future start courses
parent
b1679907
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
1 deletions
+47
-1
common/djangoapps/student/views.py
+1
-1
lms/djangoapps/branding/tests.py
+46
-0
No files found.
common/djangoapps/student/views.py
View file @
7668ef6f
...
@@ -97,7 +97,7 @@ def index(request, extra_context={}, user=None):
...
@@ -97,7 +97,7 @@ def index(request, extra_context={}, user=None):
if
domain
is
False
:
if
domain
is
False
:
domain
=
request
.
META
.
get
(
'HTTP_HOST'
)
domain
=
request
.
META
.
get
(
'HTTP_HOST'
)
courses
=
get_courses
(
None
,
domain
=
domain
)
courses
=
get_courses
(
user
,
domain
=
domain
)
courses
=
sort_by_announcement
(
courses
)
courses
=
sort_by_announcement
(
courses
)
context
=
{
'courses'
:
courses
}
context
=
{
'courses'
:
courses
}
...
...
lms/djangoapps/branding/tests.py
0 → 100644
View file @
7668ef6f
"""
Tests for branding page
"""
import
datetime
from
pytz
import
UTC
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
editable_modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.tests
import
TEST_DATA_MONGO_MODULESTORE
import
student.views
MITX_FEATURES_WITH_STARTDATE
=
settings
.
MITX_FEATURES
.
copy
()
MITX_FEATURES_WITH_STARTDATE
[
'DISABLE_START_DATES'
]
=
False
MITX_FEATURES_WO_STARTDATE
=
settings
.
MITX_FEATURES
.
copy
()
MITX_FEATURES_WO_STARTDATE
[
'DISABLE_START_DATES'
]
=
True
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
AnonymousIndexPageTest
(
ModuleStoreTestCase
):
"""
Tests that anonymous users can access the '/' page, Need courses with start date
"""
def
setUp
(
self
):
self
.
store
=
editable_modulestore
()
self
.
course
=
CourseFactory
.
create
()
self
.
course
.
days_early_for_beta
=
5
self
.
course
.
enrollment_start
=
datetime
.
datetime
.
now
(
UTC
)
+
datetime
.
timedelta
(
days
=
3
)
self
.
store
.
save_xmodule
(
self
.
course
)
@override_settings
(
MITX_FEATURES
=
MITX_FEATURES_WITH_STARTDATE
)
def
test_none_user_index_access_with_startdate_fails
(
self
):
with
self
.
assertRaises
(
Exception
):
student
.
views
.
index
(
self
.
factory
.
get
(
'/'
),
user
=
None
)
# pylint: disable=E1101
@override_settings
(
MITX_FEATURES
=
MITX_FEATURES_WITH_STARTDATE
)
def
test_anon_user_with_startdate_index
(
self
):
response
=
self
.
client
.
get
(
'/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
@override_settings
(
MITX_FEATURES
=
MITX_FEATURES_WO_STARTDATE
)
def
test_anon_user_no_startdate_index
(
self
):
response
=
self
.
client
.
get
(
'/'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
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