Commit ea351c696e85bcfaf0ebaf33e9bf2ca8d1a8b3c2

Authored by Andrew Buss
1 parent 1c546f8047
Exists in master

test that we can't hide a flashcard twice

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

flashcards/tests/test_api.py View file @ ea351c6
... ... @@ -259,6 +259,9 @@
259 259 self.assertEqual(response.status_code, HTTP_204_NO_CONTENT)
260 260 self.assertTrue(self.flashcard.is_hidden_from(self.user))
261 261  
  262 + response = self.client.post('/api/flashcards/%d/hide/' % self.flashcard.id, format='json')
  263 + self.assertContains(response, 'The card has already been hidden', status_code=400)
  264 +
262 265 response = self.client.post('/api/flashcards/%d/hide/' % self.inaccessible_flashcard.pk, format='json')
263 266 # This should fail because the user is not enrolled in section id 2
264 267 self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)