Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-data-api
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-analytics-data-api
Commits
4ac87a60
Commit
4ac87a60
authored
Sep 19, 2014
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #28 from edx/status-redirect
Redirecting Status sub-paths to Root
parents
58046383
f84db6c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
analytics_data_api/v0/tests/test_urls.py
+23
-0
analytics_data_api/v0/urls/__init__.py
+7
-0
analyticsdataserver/urls.py
+3
-3
No files found.
analytics_data_api/v0/tests/test_urls.py
0 → 100644
View file @
4ac87a60
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
class
UrlRedirectTests
(
TestCase
):
api_root_path
=
'/api/v0/'
def
assertRedirectsToRootPath
(
self
,
path
,
**
kwargs
):
assert_kwargs
=
{
'status_code'
:
301
}
assert_kwargs
.
update
(
kwargs
)
p
=
'{0}{1}/'
.
format
(
self
.
api_root_path
,
path
)
response
=
self
.
client
.
get
(
p
)
self
.
assertRedirects
(
response
,
reverse
(
path
),
**
assert_kwargs
)
def
test_authenticated
(
self
):
self
.
assertRedirectsToRootPath
(
'authenticated'
,
target_status_code
=
401
)
def
test_health
(
self
):
self
.
assertRedirectsToRootPath
(
'health'
)
def
test_status
(
self
):
self
.
assertRedirectsToRootPath
(
'status'
)
analytics_data_api/v0/urls/__init__.py
View file @
4ac87a60
from
django.conf.urls
import
patterns
,
url
,
include
from
django.core.urlresolvers
import
reverse_lazy
from
django.views.generic
import
RedirectView
urlpatterns
=
patterns
(
''
,
url
(
r'^courses/'
,
include
(
'analytics_data_api.v0.urls.courses'
,
namespace
=
'courses'
)),
url
(
r'^problems/'
,
include
(
'analytics_data_api.v0.urls.problems'
,
namespace
=
'problems'
)),
# pylint: disable=no-value-for-parameter
url
(
r'^authenticated/$'
,
RedirectView
.
as_view
(
url
=
reverse_lazy
(
'authenticated'
)),
name
=
'authenticated'
),
url
(
r'^health/$'
,
RedirectView
.
as_view
(
url
=
reverse_lazy
(
'health'
)),
name
=
'health'
),
url
(
r'^status/$'
,
RedirectView
.
as_view
(
url
=
reverse_lazy
(
'status'
)),
name
=
'status'
),
)
analyticsdataserver/urls.py
View file @
4ac87a60
...
...
@@ -15,9 +15,9 @@ urlpatterns = patterns(
url
(
r'^api/'
,
include
(
'analytics_data_api.urls'
,
namespace
=
'api'
)),
url
(
r'^docs/'
,
include
(
'rest_framework_swagger.urls'
)),
url
(
r'^status/$'
,
views
.
StatusView
.
as_view
()),
url
(
r'^authenticated/$'
,
views
.
AuthenticationTestView
.
as_view
()),
url
(
r'^health/$'
,
views
.
HealthView
.
as_view
()),
url
(
r'^status/$'
,
views
.
StatusView
.
as_view
()
,
name
=
'status'
),
url
(
r'^authenticated/$'
,
views
.
AuthenticationTestView
.
as_view
()
,
name
=
'authenticated'
),
url
(
r'^health/$'
,
views
.
HealthView
.
as_view
()
,
name
=
'health'
),
)
if
settings
.
ENABLE_ADMIN_SITE
:
# pragma: no cover
...
...
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