apps.dashboard.views & .tests.test_views now take advantage of DUPLICATE_ITEM_ERROR & ExistingListItemForm() from .forms
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
from django.test import TestCase
|
||||
from django.utils import html
|
||||
from unittest import skip
|
||||
from ..forms import EMPTY_ITEM_ERROR
|
||||
from ..forms import (
|
||||
DUPLICATE_ITEM_ERROR,
|
||||
EMPTY_ITEM_ERROR,
|
||||
)
|
||||
from ..models import Item, List
|
||||
import lxml.html
|
||||
|
||||
@@ -119,7 +122,6 @@ class DashViewTest(TestCase):
|
||||
response = self.post_invalid_input()
|
||||
self.assertContains(response, html.escape(EMPTY_ITEM_ERROR))
|
||||
|
||||
@skip
|
||||
def test_duplicate_item_validation_errors_end_up_on_lists_page(self):
|
||||
list1 = List.objects.create()
|
||||
Item.objects.create(list=list1, text="lorem ipsum")
|
||||
@@ -129,7 +131,7 @@ class DashViewTest(TestCase):
|
||||
data={"text": "lorem ipsum"},
|
||||
)
|
||||
|
||||
expected_error = html.escape("You've already logged this to your list")
|
||||
expected_error = html.escape(DUPLICATE_ITEM_ERROR)
|
||||
self.assertContains(response, expected_error)
|
||||
self.assertTemplateUsed(response, "apps/dashboard/list.html")
|
||||
self.assertEqual(Item.objects.all().count(), 1)
|
||||
|
||||
Reference in New Issue
Block a user