Exemple #1
0
 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)
Exemple #2
0
 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")
Exemple #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)
Exemple #4
0
 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,
         ),
     ]
Exemple #5
0
 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")