test_activity.py 811 B

1234567891011121314151617181920212223242526
  1. from unittest import mock
  2. from sentry.models import Activity
  3. from sentry.plugins.bases.notify import NotificationPlugin
  4. from sentry.testutils.cases import PluginTestCase
  5. from sentry.types.activity import ActivityType
  6. class BasicPreprocessorPlugin(NotificationPlugin):
  7. def notify_about_activity(self, activity):
  8. pass
  9. def is_enabled(self, project=None):
  10. return True
  11. class ActivityNotificationsTest(PluginTestCase):
  12. plugin = BasicPreprocessorPlugin
  13. @mock.patch("sentry.tasks.activity.send_activity_notifications")
  14. def test_simple(self, mock_func):
  15. group = self.create_group()
  16. Activity.objects.create_group_activity(
  17. group, ActivityType.ASSIGNED, user=self.user, data={"assignee": None}
  18. )
  19. assert mock_func.delay.call_count == 1