Esempio n. 1
0
def json_set_muted_topics(request,
                          user_profile,
                          muted_topics=REQ(validator=check_list(
                              check_list(check_string, length=2)),
                                           default=[])):
    # type: (HttpRequest, UserProfile, List[List[text_type]]) -> HttpResponse
    do_set_muted_topics(user_profile, muted_topics)
    return json_success()
Esempio n. 2
0
 def test_muted_topics_events(self):
     muted_topics_checker = check_dict([
         ('type', equals('muted_topics')),
         ('muted_topics', check_list(check_list(check_string, 2))),
     ])
     events = self.do_test(lambda: do_set_muted_topics(self.user_profile, [["Denmark", "topic"]]))
     error = muted_topics_checker('events[0]', events[0])
     self.assert_on_error(error)
Esempio n. 3
0
 def test_muted_topics_events(self):
     muted_topics_checker = check_dict([
         ('type', equals('muted_topics')),
         ('muted_topics', check_list(check_list(check_string, 2))),
     ])
     events = self.do_test(lambda: do_set_muted_topics(self.user_profile, [["Denmark", "topic"]]))
     error = muted_topics_checker('events[0]', events[0])
     self.assert_on_error(error)
Esempio n. 4
0
def json_set_muted_topics(request, user_profile,
                         muted_topics=REQ(validator=check_list(check_list(check_string, length=2)), default=[])):
    # type: (HttpRequest, UserProfile, List[List[text_type]]) -> HttpResponse
    do_set_muted_topics(user_profile, muted_topics)
    return json_success()