Created
August 19, 2016 16:22
-
-
Save horvatha/2e11b48f431c53b101db6cb817b2fc7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
import re | |
class MyTestCase(TestCase): | |
@staticmethod | |
def remove_csfr(html_code): | |
csrf_regex = r'<input[^>]+csrfmiddlewaretoken[^>]+>' | |
return re.sub(csrf_regex, '', html_code) | |
def assertEqualExceptCSFR(self, html_code1, html_code2): | |
return self.assertEqual( | |
self.remove_csfr(html_code1), | |
self.remove_csfr(html_code2) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a typo error.
Fix the "remove_csfr" with "remove_csrf"!