BOM-2369 (A): pyupgrade on api,contentstore and cms_user_tasks apps under CMS (#26676)

* pyupgrade on cms api,contentstore and cms_user_tasks apps
This commit is contained in:
M. Zulqarnain
2021-03-04 15:06:07 +05:00
committed by GitHub
parent a8449334af
commit 5562944e87
39 changed files with 231 additions and 259 deletions

View File

@@ -4,9 +4,9 @@ Unit tests for integration of the django-user-tasks app and its REST API.
import logging
from unittest import mock
from uuid import uuid4
import mock
from boto.exception import NoAuthHandlerFound
from django.conf import settings
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
@@ -80,7 +80,7 @@ class TestUserTasks(APITestCase):
cls.artifact = UserTaskArtifact.objects.create(status=cls.status, text='Lorem ipsum')
def setUp(self):
super(TestUserTasks, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.status.refresh_from_db()
self.client.force_authenticate(self.user) # pylint: disable=no-member
@@ -152,7 +152,7 @@ class TestUserTaskStopped(APITestCase):
total_steps=5)
def setUp(self):
super(TestUserTaskStopped, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
super().setUp()
self.status.refresh_from_db()
self.client.force_authenticate(self.user) # pylint: disable=no-member
@@ -169,7 +169,7 @@ class TestUserTaskStopped(APITestCase):
platform_name=settings.PLATFORM_NAME, studio_name=settings.STUDIO_NAME
)
body_fragments = [
"Your {task_name} task has completed with the status".format(task_name=self.status.name.lower()),
f"Your {self.status.name.lower()} task has completed with the status",
"https://test.edx.org/",
reverse('usertaskstatus-detail', args=[self.status.uuid])
]
@@ -202,7 +202,7 @@ class TestUserTaskStopped(APITestCase):
platform_name=settings.PLATFORM_NAME, studio_name=settings.STUDIO_NAME
)
fragments = [
"Your {task_name} task has completed with the status".format(task_name=self.status.name.lower()),
f"Your {self.status.name.lower()} task has completed with the status",
"Sign in to view the details of your task or download any files created."
]
@@ -234,4 +234,4 @@ class TestUserTaskStopped(APITestCase):
mock_delay.side_effect = NoAuthHandlerFound()
user_task_stopped.send(sender=UserTaskStatus, status=self.status)
self.assertTrue(mock_delay.called)
self.assertEqual(hdlr.messages['error'][0], u'Unable to queue send_task_complete_email')
self.assertEqual(hdlr.messages['error'][0], 'Unable to queue send_task_complete_email')