Update chatops connected integration organization check (#4268)
Related to https://github.com/grafana/oncall-private/issues/2563
This commit is contained in:
parent
65ee57f563
commit
cb613deedb
2 changed files with 15 additions and 3 deletions
|
|
@ -131,7 +131,10 @@ class CurrentOrganizationConfigChecksSerializer(serializers.ModelSerializer):
|
|||
|
||||
def get_is_integration_chatops_connected(self, obj):
|
||||
return (
|
||||
obj.alert_receive_channels.filter(channel_filters__notify_in_slack=True).exists()
|
||||
(
|
||||
obj.slack_team_identity_id is not None
|
||||
and obj.alert_receive_channels.filter(channel_filters__notify_in_slack=True).exists()
|
||||
)
|
||||
or obj.alert_receive_channels.filter(channel_filters__notify_in_telegram=True).exists()
|
||||
or obj.alert_receive_channels.filter(channel_filters__notification_backends__MSTEAMS__enabled=True).exists()
|
||||
)
|
||||
|
|
|
|||
|
|
@ -269,8 +269,17 @@ def test_get_organization_slack_config_checks(
|
|||
assert response.status_code == status.HTTP_200_OK
|
||||
assert response.json() == expected_result
|
||||
|
||||
# connect integration to Slack
|
||||
make_channel_filter(integration, notify_in_slack=True)
|
||||
# connect integration to Slack (no channel means default channel)
|
||||
channel_filter = make_channel_filter(integration, notify_in_slack=True)
|
||||
|
||||
response = client.get(url, format="json", **make_user_auth_headers(user, token))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
expected_result["is_integration_chatops_connected"] = True
|
||||
assert response.json() == expected_result
|
||||
|
||||
# connect integration to Slack (set a channel)
|
||||
channel_filter.slack_channel_id = "C123456"
|
||||
channel_filter.save()
|
||||
|
||||
response = client.get(url, format="json", **make_user_auth_headers(user, token))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue