Browse Source

Use unittest.mock

pull/340/head
Pēteris Caune 5 years ago
parent
commit
4bcfba728e
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
23 changed files with 27 additions and 23 deletions
  1. +2
    -1
      hc/accounts/tests/test_close_account.py
  2. +1
    -1
      hc/accounts/tests/test_pruneusers.py
  3. +1
    -1
      hc/accounts/tests/test_senddeletionnotices.py
  4. +1
    -1
      hc/accounts/tests/test_unsubscribe_reports.py
  5. +1
    -1
      hc/api/tests/test_check_model.py
  6. +1
    -1
      hc/api/tests/test_notify.py
  7. +1
    -1
      hc/api/tests/test_prunepingsslow.py
  8. +1
    -1
      hc/api/tests/test_sendalerts.py
  9. +1
    -1
      hc/api/tests/test_sendreports.py
  10. +1
    -1
      hc/front/tests/test_add_discord_complete.py
  11. +2
    -1
      hc/front/tests/test_add_matrix.py
  12. +1
    -1
      hc/front/tests/test_add_pushbullet_complete.py
  13. +1
    -1
      hc/front/tests/test_add_slack_complete.py
  14. +2
    -1
      hc/front/tests/test_add_telegram.py
  15. +1
    -1
      hc/front/tests/test_cron_preview.py
  16. +1
    -1
      hc/front/tests/test_send_test_notification.py
  17. +1
    -1
      hc/front/tests/test_trello_settings.py
  18. +2
    -1
      hc/front/tests/test_unsubscribe_email.py
  19. +1
    -1
      hc/payments/tests/test_address.py
  20. +1
    -1
      hc/payments/tests/test_billing_history.py
  21. +1
    -1
      hc/payments/tests/test_get_client_token.py
  22. +1
    -1
      hc/payments/tests/test_payment_method.py
  23. +1
    -1
      hc/payments/tests/test_update_subscription.py

+ 2
- 1
hc/accounts/tests/test_close_account.py View File

@ -1,8 +1,9 @@
from unittest.mock import patch
from django.contrib.auth.models import User
from hc.api.models import Check
from hc.payments.models import Subscription
from hc.test import BaseTestCase
from mock import patch
class CloseAccountTestCase(BaseTestCase):


+ 1
- 1
hc/accounts/tests/test_pruneusers.py View File

@ -1,4 +1,5 @@
from datetime import timedelta
from unittest.mock import Mock
from django.contrib.auth.models import User
from django.utils import timezone
@ -6,7 +7,6 @@ from hc.accounts.management.commands.pruneusers import Command
from hc.accounts.models import Project
from hc.api.models import Check
from hc.test import BaseTestCase
from mock import Mock
class PruneUsersTestCase(BaseTestCase):


+ 1
- 1
hc/accounts/tests/test_senddeletionnotices.py View File

@ -1,4 +1,5 @@
from datetime import timedelta as td
from unittest.mock import Mock
from django.core import mail
from django.utils.timezone import now
@ -6,7 +7,6 @@ from hc.accounts.management.commands.senddeletionnotices import Command
from hc.accounts.models import Member
from hc.api.models import Check, Ping
from hc.test import BaseTestCase
from mock import Mock
class SendDeletionNoticesTestCase(BaseTestCase):


+ 1
- 1
hc/accounts/tests/test_unsubscribe_reports.py View File

@ -1,10 +1,10 @@
from datetime import timedelta as td
import time
from unittest.mock import patch
from django.core import signing
from django.utils.timezone import now
from hc.test import BaseTestCase
from mock import patch
class UnsubscribeReportsTestCase(BaseTestCase):


+ 1
- 1
hc/api/tests/test_check_model.py View File

@ -1,9 +1,9 @@
from datetime import datetime, timedelta
from unittest.mock import patch
from django.utils import timezone
from hc.api.models import Check, Flip
from hc.test import BaseTestCase
from mock import patch
class CheckModelTestCase(BaseTestCase):


+ 1
- 1
hc/api/tests/test_notify.py View File

@ -2,12 +2,12 @@
from datetime import timedelta as td
import json
from unittest.mock import patch, Mock
from django.core import mail
from django.utils.timezone import now
from hc.api.models import Channel, Check, Notification
from hc.test import BaseTestCase
from mock import patch, Mock
from requests.exceptions import ConnectionError, Timeout
from django.test.utils import override_settings


+ 1
- 1
hc/api/tests/test_prunepingsslow.py View File

@ -1,10 +1,10 @@
from datetime import timedelta
from unittest.mock import Mock
from django.utils import timezone
from hc.api.management.commands.prunepingsslow import Command
from hc.api.models import Check, Ping
from hc.test import BaseTestCase
from mock import Mock
class PrunePingsSlowTestCase(BaseTestCase):


+ 1
- 1
hc/api/tests/test_sendalerts.py View File

@ -1,6 +1,6 @@
from datetime import timedelta as td
from io import StringIO
from mock import Mock, patch
from unittest.mock import Mock, patch
from django.core.management import call_command
from django.utils.timezone import now


+ 1
- 1
hc/api/tests/test_sendreports.py View File

@ -1,11 +1,11 @@
from datetime import timedelta as td
from unittest.mock import Mock
from django.core import mail
from django.utils.timezone import now
from hc.api.management.commands.sendreports import Command
from hc.api.models import Check
from hc.test import BaseTestCase
from mock import Mock
class SendReportsTestCase(BaseTestCase):


+ 1
- 1
hc/front/tests/test_add_discord_complete.py View File

@ -1,9 +1,9 @@
import json
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
@override_settings(DISCORD_CLIENT_ID="t1", DISCORD_CLIENT_SECRET="s1")


+ 2
- 1
hc/front/tests/test_add_matrix.py View File

@ -1,7 +1,8 @@
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
@override_settings(MATRIX_ACCESS_TOKEN="foo")


+ 1
- 1
hc/front/tests/test_add_pushbullet_complete.py View File

@ -1,9 +1,9 @@
import json
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
@override_settings(PUSHBULLET_CLIENT_ID="t1", PUSHBULLET_CLIENT_SECRET="s1")


+ 1
- 1
hc/front/tests/test_add_slack_complete.py View File

@ -1,9 +1,9 @@
import json
from unittest.mock import patch
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
@override_settings(SLACK_CLIENT_ID="fake-client-id")


+ 2
- 1
hc/front/tests/test_add_telegram.py View File

@ -1,8 +1,9 @@
from unittest.mock import patch
from django.core import signing
from django.test.utils import override_settings
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
@override_settings(TELEGRAM_TOKEN="fake-token")


+ 1
- 1
hc/front/tests/test_cron_preview.py View File

@ -1,7 +1,7 @@
from datetime import datetime
from unittest.mock import patch
from hc.test import BaseTestCase
from mock import patch
import pytz


+ 1
- 1
hc/front/tests/test_send_test_notification.py View File

@ -1,9 +1,9 @@
import json
from unittest.mock import patch
from django.core import mail
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
class SendTestNotificationTestCase(BaseTestCase):


+ 1
- 1
hc/front/tests/test_trello_settings.py View File

@ -1,4 +1,4 @@
from mock import patch
from unittest.mock import patch
from django.test.utils import override_settings
from hc.test import BaseTestCase


+ 2
- 1
hc/front/tests/test_unsubscribe_email.py View File

@ -1,8 +1,9 @@
import time
from unittest.mock import patch
from django.core.signing import TimestampSigner
from hc.api.models import Channel
from hc.test import BaseTestCase
from mock import patch
class UnsubscribeEmailTestCase(BaseTestCase):


+ 1
- 1
hc/payments/tests/test_address.py View File

@ -1,4 +1,4 @@
from mock import patch
from unittest.mock import patch
from hc.payments.models import Subscription
from hc.test import BaseTestCase


+ 1
- 1
hc/payments/tests/test_billing_history.py View File

@ -1,4 +1,4 @@
from mock import Mock, patch
from unittest.mock import Mock, patch
from django.utils.timezone import now
from hc.payments.models import Subscription


+ 1
- 1
hc/payments/tests/test_get_client_token.py View File

@ -1,4 +1,4 @@
from mock import patch
from unittest.mock import patch
from hc.payments.models import Subscription
from hc.test import BaseTestCase


+ 1
- 1
hc/payments/tests/test_payment_method.py View File

@ -1,4 +1,4 @@
from mock import patch
from unittest.mock import patch
from hc.payments.models import Subscription
from hc.test import BaseTestCase


+ 1
- 1
hc/payments/tests/test_update_subscription.py View File

@ -1,4 +1,4 @@
from mock import patch
from unittest.mock import patch
from hc.payments.models import Subscription
from hc.test import BaseTestCase


Loading…
Cancel
Save