Commit b669765c by Qubad786

TNL-4136 fix topic detail endpoint's url to support alphanumeric and period characters

parent 6cc8bbff
...@@ -14,7 +14,7 @@ from .views import ( ...@@ -14,7 +14,7 @@ from .views import (
TEAM_ID_PATTERN = r'(?P<team_id>[a-z\d_-]+)' TEAM_ID_PATTERN = r'(?P<team_id>[a-z\d_-]+)'
USERNAME_PATTERN = r'(?P<username>[\w.+-]+)' USERNAME_PATTERN = r'(?P<username>[\w.+-]+)'
TOPIC_ID_PATTERN = TEAM_ID_PATTERN.replace('team_id', 'topic_id') TOPIC_ID_PATTERN = r'(?P<topic_id>[A-Za-z\d_.-]+)'
urlpatterns = patterns( urlpatterns = patterns(
'', '',
......
...@@ -231,6 +231,11 @@ class TeamAPITestCase(APITestCase, SharedModuleStoreTestCase): ...@@ -231,6 +231,11 @@ class TeamAPITestCase(APITestCase, SharedModuleStoreTestCase):
'name': 'Public Profiles', 'name': 'Public Profiles',
'description': 'Description for topic 6.' 'description': 'Description for topic 6.'
}, },
{
'id': 'Topic_6.5',
'name': 'Test Accessibility Topic',
'description': 'Description for Topic_6.5'
},
], ],
'max_team_size': 1 'max_team_size': 1
} }
...@@ -1193,6 +1198,9 @@ class TestDetailTopicAPI(TeamAPITestCase): ...@@ -1193,6 +1198,9 @@ class TestDetailTopicAPI(TeamAPITestCase):
def test_invalid_topic_id(self): def test_invalid_topic_id(self):
self.get_topic_detail('no_such_topic', self.test_course_1.id, 404) self.get_topic_detail('no_such_topic', self.test_course_1.id, 404)
def test_topic_detail_with_caps_and_dot_in_id(self):
self.get_topic_detail('Topic_6.5', self.test_course_2.id, user='student_enrolled_public_profile')
def test_team_count(self): def test_team_count(self):
"""Test that team_count is included with a topic""" """Test that team_count is included with a topic"""
topic = self.get_topic_detail(topic_id='topic_0', course_id=self.test_course_1.id) topic = self.get_topic_detail(topic_id='topic_0', course_id=self.test_course_1.id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment