Пример #1
0
 def test_get_validated_tag_list(self):
     tag_slug_list_one = ["javascript", "mapping"]
     tags_one = get_validated_tag_list(tag_slug_list_one)
     self.assertEqual(tags_one, [self.tech_tag, self.concept_tag])
     
     tag_slug_list_two = ["javascript", "mapping", "this_tag_does_not_exist"]
     self.assertRaises(Http404, lambda: get_validated_tag_list(tag_slug_list_two))
Пример #2
0
 def get_object(self, request, *args, **kwargs):
     self.section = kwargs.get('section', None)
     self.category = kwargs.get('category', None)
     self.tag_slugs = kwargs.get('tag_slugs', None)
     if self.tag_slugs:
         self.tag_slug_list = self.tag_slugs.split('+')
         self.tags = get_validated_tag_list(self.tag_slug_list, tags=[])
     return ''