From 51201ac21796f65e41ea0b6d6e01ad201fc70cfb Mon Sep 17 00:00:00 2001 From: Andriy Danchyshyn Date: Fri, 13 Sep 2024 18:13:49 +0300 Subject: [PATCH 1/3] tests for previously approved content --- BackEnd/images/factories.py | 2 +- BackEnd/profiles/tests/test_email_sending.py | 304 +++++++++++++++++++ BackEnd/utils/moderation/image_moderation.py | 3 +- 3 files changed, 307 insertions(+), 2 deletions(-) diff --git a/BackEnd/images/factories.py b/BackEnd/images/factories.py index 37e4a776c..57dc8c936 100644 --- a/BackEnd/images/factories.py +++ b/BackEnd/images/factories.py @@ -1,5 +1,4 @@ import factory.fuzzy - from .models import ProfileImage @@ -14,5 +13,6 @@ class Meta: ) content_type = "jpeg" image_path = factory.django.ImageField(filename="test.jpeg") + hash_md5 = factory.Faker("md5") is_approved = False is_deleted = False diff --git a/BackEnd/profiles/tests/test_email_sending.py b/BackEnd/profiles/tests/test_email_sending.py index e3cff355f..57f710820 100644 --- a/BackEnd/profiles/tests/test_email_sending.py +++ b/BackEnd/profiles/tests/test_email_sending.py @@ -16,7 +16,17 @@ class TestSendModerationEmail(APITestCase): def setUp(self): self.banner = ProfileimageFactory(image_type="banner") + self.previously_approved_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5", + is_approved=True + ) self.logo = ProfileimageFactory(image_type="logo") + self.previously_approved_logo = ProfileimageFactory( + image_type="banner", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe", + is_approved=True + ) self.user = UserFactory(email="test1@test.com") self.profile = ProfileStartupFactory.create( person=self.user, @@ -150,6 +160,72 @@ def test_send_moderation_email_new_banner_approved_logo(self): os.path.basename(self.banner.image_path.name), ) + def test_send_moderation_email_previously_approved_banner(self): + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.banner = new_banner + self.profile.logo = self.logo + + manager = ModerationManager(self.profile) + manager.check_for_moderation() + banner = manager.images["banner"] + logo = manager.images["logo"] + content_is_deleted = manager.content_deleted + send_moderation_email(self.profile, banner, logo, content_is_deleted) + + self.assertEqual(len(mail.outbox), 1) + email_data = mail.outbox[0] + self.assertEqual( + email_data.subject, + f"{self.profile.name} - {self.profile.status_updated_at.strftime('%d.%m.%Y')}: Запит на затвердження змін в обліковому записі компанії", + ) + self.assertIn(self.profile.name, email_data.body) + self.assertIn( + self.profile.status_updated_at.strftime("%d.%m.%Y %H:%M"), + email_data.body, + ) + + self.assertEqual(len(email_data.attachments), 1) + self.assertEqual( + email_data.attachments[0].get_filename(), + os.path.basename(self.logo.image_path.name), + ) + + def test_send_moderation_email_previously_approved_logo(self): + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + self.profile.banner = self.banner + self.profile.logo = new_logo + + manager = ModerationManager(self.profile) + manager.check_for_moderation() + banner = manager.images["banner"] + logo = manager.images["logo"] + content_is_deleted = manager.content_deleted + send_moderation_email(self.profile, banner, logo, content_is_deleted) + + self.assertEqual(len(mail.outbox), 1) + email_data = mail.outbox[0] + self.assertEqual( + email_data.subject, + f"{self.profile.name} - {self.profile.status_updated_at.strftime('%d.%m.%Y')}: Запит на затвердження змін в обліковому записі компанії", + ) + self.assertIn(self.profile.name, email_data.body) + self.assertIn( + self.profile.status_updated_at.strftime("%d.%m.%Y %H:%M"), + email_data.body, + ) + + self.assertEqual(len(email_data.attachments), 1) + self.assertEqual( + email_data.attachments[0].get_filename(), + os.path.basename(self.banner.image_path.name), + ) + # test for deleted images def test_content_deleted_email_with_pending_status(self): self.profile.status = self.profile.PENDING @@ -187,11 +263,96 @@ def test_remove_pending_image_keep_approved_image(self): self.assertTrue(self.profile.banner.is_approved) self.assertIsNone(self.profile.logo) + def test_content_deleted_previously_approved_banner(self): + self.profile.banner = self.banner + self.profile.status = self.profile.PENDING + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.banner = new_banner + manager = ModerationManager(self.profile) + manager.check_for_moderation() + banner = manager.images["banner"] + logo = manager.images["logo"] + content_is_deleted = manager.content_deleted + send_moderation_email(self.profile, banner, logo, content_is_deleted) + + self.assertIn( + "Інформуємо про те що попередньо доданий контент було видалено користувачем.", + mail.outbox[0].body, + ) + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertEqual(self.profile.banner, new_banner) + self.assertIsNone(self.profile.logo) + + def test_content_deleted_previously_approved_logo(self): + self.profile.logo = self.logo + self.profile.status = self.profile.PENDING + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + self.profile.logo = new_logo + manager = ModerationManager(self.profile) + manager.check_for_moderation() + banner = manager.images["banner"] + logo = manager.images["logo"] + content_is_deleted = manager.content_deleted + send_moderation_email(self.profile, banner, logo, content_is_deleted) + + self.assertIn( + "Інформуємо про те що попередньо доданий контент було видалено користувачем.", + mail.outbox[0].body, + ) + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertEqual(self.profile.logo, new_logo) + self.assertIsNone(self.profile.banner) + + def test_content_deleted_previously_approved_both(self): + self.profile.banner = self.banner + self.profile.logo = self.logo + self.profile.status = self.profile.PENDING + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.logo = new_logo + self.profile.banner = new_banner + manager = ModerationManager(self.profile) + manager.check_for_moderation() + banner = manager.images["banner"] + logo = manager.images["logo"] + content_is_deleted = manager.content_deleted + send_moderation_email(self.profile, banner, logo, content_is_deleted) + + self.assertIn( + "Інформуємо про те що попередньо доданий контент було видалено користувачем.", + mail.outbox[0].body, + ) + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertEqual(self.profile.logo, new_logo) + self.assertEqual(self.profile.banner, new_banner) + class TestSendModerationManager(APITestCase): def setUp(self): self.banner = ProfileimageFactory(image_type="banner") + self.previously_approved_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5", + is_approved=True + ) self.logo = ProfileimageFactory(image_type="logo") + self.previously_approved_logo = ProfileimageFactory( + image_type="banner", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe", + is_approved=True + ) self.user = UserFactory(email="test1@test.com") self.profile = ProfileStartupFactory.create( person=self.user, @@ -210,6 +371,12 @@ def test_needs_moderation_approved_image(self): self.logo.is_approved = True self.assertFalse(self.manager.needs_moderation(self.banner)) self.assertFalse(self.manager.needs_moderation(self.logo)) + self.assertFalse( + self.manager.needs_moderation(self.previously_approved_banner) + ) + self.assertFalse( + self.manager.needs_moderation(self.previously_approved_logo) + ) def test_needs_moderation_deleted_image(self): self.assertFalse(self.manager.needs_moderation(self.profile.banner)) @@ -223,6 +390,42 @@ def test_update_pending_status(self, mock_now): self.assertEqual(self.profile.status_updated_at, mock_now.return_value) self.assertTrue(self.manager.moderation_is_needed) + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) + def test_update_pending_status_previously_approved_banner(self, mock_now): + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.banner = new_banner + self.manager.update_pending_status("banner", self.profile.banner) + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertEqual(self.profile.status_updated_at, mock_now.return_value) + self.assertFalse(self.manager.moderation_is_needed) + + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) + def test_update_pending_status_previously_approved_logo(self, mock_now): + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + self.profile.logo = new_logo + self.manager.update_pending_status("logo", self.profile.logo) + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertEqual(self.profile.status_updated_at, mock_now.return_value) + self.assertFalse(self.manager.moderation_is_needed) + + def test_previously_approved_content_pending_status(self): + self.profile.banner = self.banner + self.profile.status = self.profile.PENDING + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + self.profile.logo = new_logo + self.manager.update_pending_status("logo", self.profile.logo) + self.assertEqual(self.profile.status, self.profile.PENDING) + self.assertFalse(self.manager.moderation_is_needed) + # cases for moderation is needed @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_check_for_moderation(self, mock_now): @@ -237,6 +440,40 @@ def test_check_for_moderation(self, mock_now): {"banner": self.banner, "logo": self.logo}, ) + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) + def test_check_for_moderation_previously_approved_banner(self, mock_now): + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.banner = new_banner + self.profile.logo = self.logo + self.manager.check_for_moderation() + self.assertEqual(self.profile.status, self.profile.PENDING) + self.assertEqual(self.profile.status_updated_at, mock_now.return_value) + self.assertTrue(self.manager.moderation_is_needed) + self.assertEqual( + self.manager.images, + {"banner": None, "logo": self.logo}, + ) + + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) + def test_check_for_moderation_previously_approved_logo(self, mock_now): + self.profile.banner = self.banner + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + self.profile.logo = new_logo + self.manager.check_for_moderation() + self.assertEqual(self.profile.status, self.profile.PENDING) + self.assertEqual(self.profile.status_updated_at, mock_now.return_value) + self.assertTrue(self.manager.moderation_is_needed) + self.assertEqual( + self.manager.images, + {"banner": self.banner, "logo": None}, + ) + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_check_for_moderation_empty_banner(self, mock_now): self.profile.logo = self.logo @@ -273,6 +510,34 @@ def test_check_for_moderation_with_approved_image(self, mock_now): {"banner": None, "logo": self.logo}, ) + def test_previously_approved_banner_empty_logo(self): + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.banner = new_banner + self.manager.check_for_moderation() + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertFalse(self.manager.moderation_is_needed) + self.assertEqual( + self.manager.images, + {"banner": None, "logo": None}, + ) + + def test_previously_approved_logo_empty_banner(self): + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + self.profile.logo = new_logo + self.manager.check_for_moderation() + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertFalse(self.manager.moderation_is_needed) + self.assertEqual( + self.manager.images, + {"banner": None, "logo": None}, + ) + # handle the deletion of a new image @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_handle_approved_image_status_pending(self, mock_now): @@ -318,6 +583,45 @@ def test_undefined_status_after_approved_images_deleted(self): self.assertFalse(self.manager.content_deleted) self.assertEqual(self.manager.images, {"banner": None, "logo": None}) + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) + def test_handle_both_approved(self, mock_now): + self.profile.status = self.profile.PENDING + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.logo = new_logo + self.profile.banner = new_banner + self.manager.check_for_moderation() + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertFalse(self.manager.moderation_is_needed) + self.assertTrue(self.manager.content_deleted) + self.assertEqual(self.profile.status_updated_at, mock_now.return_value) + self.assertEqual(self.manager.images, {"banner": None, "logo": None}) + + @mock.patch("utils.moderation.image_moderation.now", return_value=now()) + def test_handle_both_approved_pending_status(self, mock_now): + new_logo = ProfileimageFactory( + image_type="logo", + hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + ) + new_banner = ProfileimageFactory( + image_type="banner", + hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + ) + self.profile.logo = new_logo + self.profile.banner = new_banner + self.manager.check_for_moderation() + self.assertEqual(self.profile.status, self.profile.APPROVED) + self.assertFalse(self.manager.moderation_is_needed) + self.assertFalse(self.manager.content_deleted) + self.assertEqual(self.profile.status_updated_at, mock_now.return_value) + self.assertEqual(self.manager.images, {"banner": None, "logo": None}) + class TestApprovedImagesDeleter(APITestCase): def setUp(self): diff --git a/BackEnd/utils/moderation/image_moderation.py b/BackEnd/utils/moderation/image_moderation.py index c2e80981c..c8624135a 100644 --- a/BackEnd/utils/moderation/image_moderation.py +++ b/BackEnd/utils/moderation/image_moderation.py @@ -26,6 +26,7 @@ def handle_both_approved(self): if self.profile.status == self.profile.PENDING: self.content_deleted = True self.profile.status = self.profile.APPROVED + self.profile.status_updated_at = now() self.profile.save() def handle_approved_status(self, secondary_image): @@ -58,7 +59,7 @@ def update_pending_status(self, image_type, image): image.save() if self.profile.status != self.profile.PENDING: self.profile.status = self.profile.APPROVED - self.profile.status_updated_at = now() + self.profile.status_updated_at = now() setattr(self.profile, f"{image_type}_approved", image) self.profile.save() completeness_count(self.profile) From 54ef7750d934851304e106e5fc137e1a89fa30d8 Mon Sep 17 00:00:00 2001 From: Andriy Danchyshyn Date: Fri, 13 Sep 2024 18:16:04 +0300 Subject: [PATCH 2/3] black formatting --- BackEnd/profiles/tests/test_email_sending.py | 59 +++++++------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/BackEnd/profiles/tests/test_email_sending.py b/BackEnd/profiles/tests/test_email_sending.py index 57f710820..f35667d39 100644 --- a/BackEnd/profiles/tests/test_email_sending.py +++ b/BackEnd/profiles/tests/test_email_sending.py @@ -19,13 +19,13 @@ def setUp(self): self.previously_approved_banner = ProfileimageFactory( image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5", - is_approved=True + is_approved=True, ) self.logo = ProfileimageFactory(image_type="logo") self.previously_approved_logo = ProfileimageFactory( image_type="banner", hash_md5="b4094f9fa6e298a6e25c1dba791868fe", - is_approved=True + is_approved=True, ) self.user = UserFactory(email="test1@test.com") self.profile = ProfileStartupFactory.create( @@ -162,8 +162,7 @@ def test_send_moderation_email_new_banner_approved_logo(self): def test_send_moderation_email_previously_approved_banner(self): new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.banner = new_banner self.profile.logo = self.logo @@ -195,8 +194,7 @@ def test_send_moderation_email_previously_approved_banner(self): def test_send_moderation_email_previously_approved_logo(self): new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) self.profile.banner = self.banner self.profile.logo = new_logo @@ -267,8 +265,7 @@ def test_content_deleted_previously_approved_banner(self): self.profile.banner = self.banner self.profile.status = self.profile.PENDING new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.banner = new_banner manager = ModerationManager(self.profile) @@ -290,8 +287,7 @@ def test_content_deleted_previously_approved_logo(self): self.profile.logo = self.logo self.profile.status = self.profile.PENDING new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) self.profile.logo = new_logo manager = ModerationManager(self.profile) @@ -314,12 +310,10 @@ def test_content_deleted_previously_approved_both(self): self.profile.logo = self.logo self.profile.status = self.profile.PENDING new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.logo = new_logo self.profile.banner = new_banner @@ -345,13 +339,13 @@ def setUp(self): self.previously_approved_banner = ProfileimageFactory( image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5", - is_approved=True + is_approved=True, ) self.logo = ProfileimageFactory(image_type="logo") self.previously_approved_logo = ProfileimageFactory( image_type="banner", hash_md5="b4094f9fa6e298a6e25c1dba791868fe", - is_approved=True + is_approved=True, ) self.user = UserFactory(email="test1@test.com") self.profile = ProfileStartupFactory.create( @@ -393,8 +387,7 @@ def test_update_pending_status(self, mock_now): @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_update_pending_status_previously_approved_banner(self, mock_now): new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.banner = new_banner self.manager.update_pending_status("banner", self.profile.banner) @@ -405,8 +398,7 @@ def test_update_pending_status_previously_approved_banner(self, mock_now): @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_update_pending_status_previously_approved_logo(self, mock_now): new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) self.profile.logo = new_logo self.manager.update_pending_status("logo", self.profile.logo) @@ -418,8 +410,7 @@ def test_previously_approved_content_pending_status(self): self.profile.banner = self.banner self.profile.status = self.profile.PENDING new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) self.profile.logo = new_logo self.manager.update_pending_status("logo", self.profile.logo) @@ -443,8 +434,7 @@ def test_check_for_moderation(self, mock_now): @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_check_for_moderation_previously_approved_banner(self, mock_now): new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.banner = new_banner self.profile.logo = self.logo @@ -461,8 +451,7 @@ def test_check_for_moderation_previously_approved_banner(self, mock_now): def test_check_for_moderation_previously_approved_logo(self, mock_now): self.profile.banner = self.banner new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) self.profile.logo = new_logo self.manager.check_for_moderation() @@ -512,8 +501,7 @@ def test_check_for_moderation_with_approved_image(self, mock_now): def test_previously_approved_banner_empty_logo(self): new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.banner = new_banner self.manager.check_for_moderation() @@ -526,8 +514,7 @@ def test_previously_approved_banner_empty_logo(self): def test_previously_approved_logo_empty_banner(self): new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) self.profile.logo = new_logo self.manager.check_for_moderation() @@ -587,12 +574,10 @@ def test_undefined_status_after_approved_images_deleted(self): def test_handle_both_approved(self, mock_now): self.profile.status = self.profile.PENDING new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.logo = new_logo self.profile.banner = new_banner @@ -606,12 +591,10 @@ def test_handle_both_approved(self, mock_now): @mock.patch("utils.moderation.image_moderation.now", return_value=now()) def test_handle_both_approved_pending_status(self, mock_now): new_logo = ProfileimageFactory( - image_type="logo", - hash_md5="b4094f9fa6e298a6e25c1dba791868fe" + image_type="logo", hash_md5="b4094f9fa6e298a6e25c1dba791868fe" ) new_banner = ProfileimageFactory( - image_type="banner", - hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" + image_type="banner", hash_md5="0dc41dd9dcbc75e730642dbfb87cd1d5" ) self.profile.logo = new_logo self.profile.banner = new_banner From 3ad21254edbd37c314402c47e937fa27ee9c40cf Mon Sep 17 00:00:00 2001 From: Andriy Danchyshyn Date: Fri, 13 Sep 2024 18:51:50 +0300 Subject: [PATCH 3/3] removed redundant imports --- BackEnd/profiles/tests/test_crud_profile.py | 1 - BackEnd/profiles/tests/test_email_sending.py | 1 - 2 files changed, 2 deletions(-) diff --git a/BackEnd/profiles/tests/test_crud_profile.py b/BackEnd/profiles/tests/test_crud_profile.py index 55564b66c..b0d7a63d3 100644 --- a/BackEnd/profiles/tests/test_crud_profile.py +++ b/BackEnd/profiles/tests/test_crud_profile.py @@ -14,7 +14,6 @@ from images.factories import ProfileimageFactory from utils.dump_response import dump # noqa from utils.unittest_helper import AnyInt -from django.core.files.uploadedfile import SimpleUploadedFile class TestProfileDetailAPIView(APITestCase): diff --git a/BackEnd/profiles/tests/test_email_sending.py b/BackEnd/profiles/tests/test_email_sending.py index f35667d39..7a80120b8 100644 --- a/BackEnd/profiles/tests/test_email_sending.py +++ b/BackEnd/profiles/tests/test_email_sending.py @@ -1,5 +1,4 @@ import os -from django.conf import settings from rest_framework.test import APITestCase from unittest import mock from django.utils.timezone import now