Revert "PROD-145: Added validation to discussion topic input in studio, testing 2"

This commit is contained in:
Bill DeRusha
2019-08-20 20:31:15 -04:00
committed by GitHub
parent 0ad8753cd6
commit aebdf77f8e
4 changed files with 22 additions and 62 deletions

View File

@@ -120,19 +120,7 @@ def topic_name_to_id(course, name):
"""
Given a discussion topic name, return an id for that name (includes
course and url_name).
The set of valid characters for topic id is a smaller subset of valid
characters for topic name. Topic id can only have
these characters: a-z, A-Z, 0-9, underscore, hyphen, and period
Whereas, topic name character choice is much larger.
This function goes through all the characters in name and removes all invalid
characters and returns the resulting topic id.
"""
for index, indexed_character in enumerate(name):
if not (indexed_character.isalnum()
or indexed_character == "-"
or indexed_character == "_"
or indexed_character == "."):
name = name[:index] + "_" + name[index + 1:]
return "{course}_{run}_{name}".format(
course=course.location.course,
run=course.url_name,

View File

@@ -1931,7 +1931,7 @@ class CourseDiscussionSettingsAPIViewTest(APITestCase, UrlResetMixin, ModuleStor
start=datetime.now()
)
discussion_topics = {
"Topic B": {"id": "Topic_B"},
"Topic B": {"id": "Topic B"},
}
config_course_cohorts(self.course, is_cohorted=True)
config_course_discussions(
@@ -2076,7 +2076,7 @@ class CourseDiscussionSettingsAPIViewTest(APITestCase, UrlResetMixin, ModuleStor
def test_update_course_wide_discussion_settings(self):
"""Test whether the 'divided_course_wide_discussions' setting is updated."""
discussion_topics = {
'Topic B': {'id': 'Topic_B'}
'Topic B': {'id': 'Topic B'}
}
config_course_cohorts(self.course, is_cohorted=True)
config_course_discussions(self.course, discussion_topics=discussion_topics)