fix(test): Remove frappe.local.request between requests
`frappe.local.request` was not cleared between tests, which would not be a problem if all tests did set it to another Request object. But, some tests directly fetch the response content using get_response_content without first setting the frappe.local.request object (using set_request).
This commit is contained in:
parent
bcdc483a13
commit
9afedfae25
1 changed files with 6 additions and 0 deletions
|
|
@ -11,10 +11,16 @@ from frappe.website.utils import build_response, clear_website_cache, get_home_p
|
|||
class TestWebsite(FrappeTestCase):
|
||||
def setUp(self):
|
||||
frappe.set_user("Guest")
|
||||
self._clearRequest()
|
||||
|
||||
def tearDown(self):
|
||||
frappe.db.delete("Access Log")
|
||||
frappe.set_user("Administrator")
|
||||
self._clearRequest()
|
||||
|
||||
def _clearRequest(self):
|
||||
if hasattr(frappe.local, "request"):
|
||||
delattr(frappe.local, "request")
|
||||
|
||||
def test_home_page(self):
|
||||
frappe.set_user("Administrator")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue