Skip to content

Commit

Permalink
fix: object has no attribute is_ajax (openedx#33134)
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram authored and Yagnesh committed Sep 1, 2023
1 parent 3b15fd6 commit 89129e8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lms/djangoapps/instructor/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,24 +265,24 @@ def test_happy_path(self):
assert resp.status_code == 200

def test_user_doesnotexist(self):
self.request.is_ajax.return_value = False
self.request.accepts("application/json").return_value = False
resp = view_user_doesnotexist(self.request)
self.assertContains(resp, "User does not exist", status_code=400)

def test_user_doesnotexist_ajax(self):
self.request.is_ajax.return_value = True
self.request.accepts("application/json").return_value = True
resp = view_user_doesnotexist(self.request)
self.assertContains(resp, "User does not exist", status_code=400)

@ddt.data(True, False)
def test_alreadyrunningerror(self, is_ajax):
self.request.is_ajax.return_value = is_ajax
self.request.accepts("application/json").return_value = is_ajax
resp = view_alreadyrunningerror(self.request)
self.assertContains(resp, "Requested task is already running", status_code=400)

@ddt.data(True, False)
def test_alreadyrunningerror_with_unicode(self, is_ajax):
self.request.is_ajax.return_value = is_ajax
self.request.accepts("application/json").return_value = is_ajax
resp = view_alreadyrunningerror_unicode(self.request)
self.assertContains(
resp,
Expand All @@ -295,7 +295,7 @@ def test_queue_connection_error(self, is_ajax):
"""
Tests that QueueConnectionError exception is handled in common_exception_400.
"""
self.request.is_ajax.return_value = is_ajax
self.request.accepts("application/json").return_value = is_ajax
resp = view_queue_connection_error(self.request)
self.assertContains(
resp,
Expand Down

0 comments on commit 89129e8

Please sign in to comment.