Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Django 4.2]: Fix: object has no attribute 'is_ajax' #33134

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading