Exemplo n.º 1
0
 def test_get_all_tags_by_post_id(self):
     file_object1 = werkzeug.datastructures.FileStorage(filename="fileupload1.JPG")
     file_object2 = werkzeug.datastructures.FileStorage(filename="fileupload2.JPG")
     p = Post.create(author_id=1, description="test", file_name=None, tag_list="food,fashion", choice_data=[("text_choice1", file_object1), ("text_choice2", file_object2)])
     tags = Tag.get_tags_by_post_id(p.post_id)
     tag_names = [str(tag.tag_name) for tag in tags]
     self.assertIn('food', tag_names)
     self.assertIn('fashion', tag_names)
     self.assertNotIn("apple", tag_names)