コード例 #1
0
ファイル: test_board.py プロジェクト: sztang/open-synthesis
 def test_pagination(self):
     """Test that the correct boards show up on each page."""
     for x in range(1, 30):
         # views shows boards in order descending publishing data; set data so board n is published after board n+1
         create_board("Test Board {}".format(x), days=100 - x)
     response = self.client.get(reverse("openach:boards") + "?page=1")
     self.assertContains(response, "Test Board 1", status_code=200)
     response = self.client.get(reverse("openach:boards") + "?page=2")
     self.assertContains(response, "Test Board 15", status_code=200)
コード例 #2
0
ファイル: test_board.py プロジェクト: sztang/open-synthesis
 def test_can_show_board_listing_no_page(self):
     """Test that board listing renders when no page number is provided."""
     board = create_board("Test Board", days=0)
     response = self.client.get(reverse("openach:boards"))
     self.assertTemplateUsed(response, "boards/boards.html")
     self.assertContains(response, board.board_title, status_code=200)
     self.assertContains(response, "1")
コード例 #3
0
 def test_edit_permissions_permission(self):
     board = create_board("Board Title")
     board.permissions.update_all(AuthLevels.board_creator)
     self.login()
     response = self.client.post(
         reverse("openach:edit_permissions", args=(board.id, )))
     self.assertEqual(response.status_code, 403)
コード例 #4
0
ファイル: test_board.py プロジェクト: sztang/open-synthesis
 def setUp(self):
     super().setUp()
     self.board = create_board("Test Board", days=5)
     self.hypotheses = [
         Hypothesis.objects.create(
             board=self.board, hypothesis_text="Hypothesis #1", creator=self.user,
         ),
         Hypothesis.objects.create(
             board=self.board, hypothesis_text="Hypothesis #2", creator=self.user,
         ),
     ]
コード例 #5
0
ファイル: test_board.py プロジェクト: sztang/open-synthesis
 def test_can_show_board_listing_first_page(self):
     """Test board listing for when the first page is provided."""
     board = create_board("Test Board", days=0)
     response = self.client.get(reverse("openach:boards") + "?page=1")
     self.assertContains(response, board.board_title, status_code=200)
     self.assertContains(response, "1")