完善部分测试

This commit is contained in:
hohoTT
2015-08-29 15:20:49 +08:00
parent a216f8e1ea
commit 2252107a80
6 changed files with 30 additions and 9 deletions

View File

@@ -187,5 +187,19 @@ class ProblemListPageTest(TestCase):
hint="hint1",
created_by=User.objects.get(username="test"))
def test_problemListPage_not_exist(self):
response = self.client.get('/problems/999/')
self.assertTemplateUsed(response, "utils/error.html")
def test_query_by_keyword(self):
response = self.client.get(self.url + "?keyword=title1")
self.assertEqual(response.status_code, 200)
def test_query_by_tag_successfully(self):
response = self.client.get(self.url + "?tag=")
self.assertEqual(response.status_code, 200)
def test_tag_does_not_exists(self):
response = self.client.get(self.url + "?tag=xxxxxx")
self.assertTemplateUsed(response, "utils/error.html")