Mercurial > public > sg101
changeset 1202:50e511e032db
Get unit tests working again.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 04 Jan 2025 14:10:38 -0600 |
parents | fe10aea76cbd |
children | 8cd15df9b563 |
files | donations/tests.py user_photos/tests/test_forms.py |
diffstat | 2 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/donations/tests.py Sun Mar 24 14:50:23 2024 -0500 +++ b/donations/tests.py Sat Jan 04 14:10:38 2025 -0600 @@ -116,9 +116,9 @@ def test_monthly_goal_pct(self): - self.assertEqual(settings.DONATIONS_GOAL, Decimal('120.00')) + self.assertEqual(settings.DONATIONS_GOAL, Decimal('94.00')) pct = Donation.objects.monthly_goal_pct(year=2012, month=9) - self.assertEqual(pct, 19) + self.assertEqual(pct, 24) def test_monthly_goal_pct2(self):
--- 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)