I Think the two csrf value is not same that is why my test case is failing. How do i test the template is working good?
FAIL: test_home_page_can_save_a_POST_request (lists.tests.HomePageTest)
Traceback (most recent call last): File "G:\dj_proj\ObeyTheTestingGoat\superlists\lists\tests.py", line 46, in te st_home_page_can_save_a_POST_request
self.assertEqual(response.content.decode(), expect_html)
AssertionError: '<!DO[178 chars]lue="mksJcHsmmhRKsu96jGJaqz7sh593cCLcG8AEkK5CC[2
13 chars]tml>' != '<!DO[178 chars]lue="kGamofdgnvgVD2MfLaIZKrLQ99WOYjzlEuihwiQwD
[213 chars]tml>'
Ran 4 tests in 0.015s
FAILED (failures=1) Destroying test database for alias 'default'...
def test_home_page_can_save_a_POST_request(self):
request = HttpRequest()
request.method = 'POST'
request.POST['item_text'] = 'A new list item'
response = views.home_page(request)
self.assertIn('A new list item', response.content.decode())
expect_html = render_to_string('home.html', context={'new_item_text':'A new list item'}, request=request)
self.assertEqual(response.content.decode(), expect_html)