diff user_photos/tests/test_forms.py @ 1202:50e511e032db

Get unit tests working again.
author Brian Neal <bgneal@gmail.com>
date Sat, 04 Jan 2025 14:10:38 -0600
parents f5aa74dcdd7a
children
line wrap: on
line diff
--- a/user_photos/tests/test_forms.py	Sun Mar 24 14:50:23 2024 -0500
+++ b/user_photos/tests/test_forms.py	Sat Jan 04 14:10:38 2025 -0600
@@ -48,9 +48,8 @@
     @mock.patch('user_photos.forms.rate_limit_user')
     @mock.patch('user_photos.forms.download_file')
     @mock.patch('user_photos.forms.remove_file', new=fake_remove_file)
-    @mock.patch('user_photos.forms.S3Bucket')
-    @mock.patch('user_photos.forms.upload')
-    def test_white_listed_url(self, upload_mock, bucket_mock, dl_mock, rate_limit_mock):
+    @mock.patch('user_photos.forms.process_upload')
+    def test_white_listed_url(self, upload_mock, dl_mock, rate_limit_mock):
         url = 'https://{}/a.jpg'.format(settings.USER_IMAGES_SOURCES[0])
         args = {'url': url}
         form = HotLinkImageForm(args, user=self.user)
@@ -58,15 +57,13 @@
         result = form.save()
         self.assertEqual(result, url)
         self.assertFalse(dl_mock.called)
-        self.assertFalse(bucket_mock.called)
         self.assertFalse(upload_mock.called)
 
     @mock.patch('user_photos.forms.rate_limit_user')
     @mock.patch('user_photos.forms.download_file')
     @mock.patch('user_photos.forms.remove_file', new=fake_remove_file)
-    @mock.patch('user_photos.forms.S3Bucket')
-    @mock.patch('user_photos.forms.upload')
-    def test_happy_path(self, upload_mock, bucket_mock, dl_mock, rate_limit_mock):
+    @mock.patch('user_photos.forms.process_upload')
+    def test_happy_path(self, upload_mock, dl_mock, rate_limit_mock):
         url = 'http://example.com/a.jpg'
         args = {'url': url}
         form = HotLinkImageForm(args, user=self.user)