예제 #1
0
    def test_find_post_with_invalid_categories(self):

        try:
            Post.find_post_by_category("")
            self.fail("Expect InvalidFieldError")
        except InvalidFieldError:
            pass
예제 #2
0
    def test_find_post_with_not_exist_keyword(self):

        posts = Post.find_post_by_category("Java")
        self.assertEqual(len(posts), 0)
예제 #3
0
 def test_find_post_with_valid_info(self):
     posts = Post.find_post_by_category("Python", 1, 3)
     self.assertEqual(len(posts), 3)
예제 #4
0
 def test_find_post_with_out_of_range_index(self):
     posts = Post.find_post_by_category("C++", 4, 7)
     self.assertEqual(len(posts), 0)
예제 #5
0
 def test_find_post_with_invalid_pagination_param(self):
     posts = Post.find_post_by_category("NON IT", 0, -2)
     self.assertEqual(len(posts), 7)