latest changes
This commit is contained in:
@@ -53,6 +53,20 @@ class RecipeMatchTests(TestCase):
|
||||
with transaction.atomic(), self.assertRaises(IntegrityError):
|
||||
RecipeSelection.objects.create(user=self.user, recipe=self.recipe)
|
||||
|
||||
def test_reset_restores_own_cards_and_preserves_other_picks(self):
|
||||
RecipeSelection.objects.create(user=self.demo, recipe=self.recipe)
|
||||
RecipeSelection.objects.create(user=self.other, recipe=self.recipe)
|
||||
RecipeSelection.objects.create(user=self.user, recipe=self.recipe)
|
||||
url = reverse('recipes:match-reset')
|
||||
self.assertEqual(self.client.get(url).status_code, 405)
|
||||
self.assertNotContains(self.client.get(reverse('recipes:match')), 'Lemon salmon')
|
||||
response = self.client.post(url)
|
||||
self.assertRedirects(response, reverse('recipes:match'))
|
||||
self.assertFalse(RecipeSelection.objects.filter(user=self.user).exists())
|
||||
self.assertTrue(RecipeSelection.objects.filter(user=self.demo, recipe=self.recipe).exists())
|
||||
self.assertTrue(RecipeSelection.objects.filter(user=self.other, recipe=self.recipe).exists())
|
||||
self.assertContains(self.client.get(reverse('recipes:match')), 'Lemon salmon')
|
||||
|
||||
def test_seed_and_reset_uses_existing_demo_recipes(self):
|
||||
self.recipe.status = Recipe.Status.DRAFT
|
||||
self.recipe.save(update_fields=('status',))
|
||||
|
||||
Reference in New Issue
Block a user