Beispiel #1
0
    def test_where_should_be_participating(self):
        subscription = GroupSubscription(is_active=True)
        notification_settings = {
            self.user: {
                NotificationScopeType.USER: {
                    ExternalProviders.EMAIL: NotificationSettingOptionValues.ALWAYS,
                    ExternalProviders.SLACK: NotificationSettingOptionValues.SUBSCRIBE_ONLY,
                    ExternalProviders.PAGERDUTY: NotificationSettingOptionValues.NEVER,
                }
            }
        }

        providers = where_should_be_participating(
            self.user,
            subscription,
            notification_settings,
        )
        assert providers == [ExternalProviders.EMAIL, ExternalProviders.SLACK]
Beispiel #2
0
 def setUp(self) -> None:
     self.group_subscription = GroupSubscription(is_active=True)
     self.user = User(id=1)
     self.project = Project(id=1)
     self.group = Group(id=1)
 def setUp(self) -> None:
     self.group_subscription = GroupSubscription(is_active=True)
Beispiel #4
0
 def test_subscription_on_notification_settings_always(self):
     subscription = GroupSubscription(is_active=True)
     value = should_be_participating(subscription, NotificationSettingOptionValues.ALWAYS)
     assert value
Beispiel #5
0
 def test_subscription_off_subscribe_only(self):
     subscription = GroupSubscription(is_active=False)
     value = should_be_participating(
         subscription, NotificationSettingOptionValues.SUBSCRIBE_ONLY
     )
     assert not value
Beispiel #6
0
 def test_subscription_off_notification_setting_never(self):
     subscription = GroupSubscription(is_active=False)
     value = should_be_participating(subscription, NotificationSettingOptionValues.NEVER)
     assert not value