Skip to content

Commit

Permalink
Add msteams feature flag (#3606)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasb authored Jan 2, 2024
1 parent 6c7bc4d commit 4c8870f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions engine/apps/api/tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
FEATURE_GRAFANA_CLOUD_CONNECTION,
FEATURE_GRAFANA_CLOUD_NOTIFICATIONS,
FEATURE_LIVE_SETTINGS,
FEATURE_MSTEAMS,
FEATURE_SLACK,
FEATURE_TELEGRAM,
)
Expand Down Expand Up @@ -77,6 +78,22 @@ def test_oss_features_enabled_in_oss_installation_by_default(
assert response.status_code == status.HTTP_200_OK
assert FEATURE_GRAFANA_CLOUD_CONNECTION in response.json()
assert FEATURE_GRAFANA_CLOUD_NOTIFICATIONS in response.json()
assert FEATURE_MSTEAMS not in response.json()


@pytest.mark.django_db
@override_settings(IS_OPEN_SOURCE=False)
def test_non_oss_features_enabled(
make_organization_and_user_with_plugin_token,
make_user_auth_headers,
):
_, user, token = make_organization_and_user_with_plugin_token()
client = APIClient()
url = reverse("api-internal:features")
response = client.get(url, format="json", **make_user_auth_headers(user, token))

assert response.status_code == status.HTTP_200_OK
assert FEATURE_MSTEAMS in response.json()


@pytest.mark.django_db
Expand Down
3 changes: 3 additions & 0 deletions engine/apps/api/views/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from apps.base.utils import live_settings
from apps.labels.utils import is_labels_feature_enabled

FEATURE_MSTEAMS = "msteams"
FEATURE_SLACK = "slack"
FEATURE_TELEGRAM = "telegram"
FEATURE_LIVE_SETTINGS = "live_settings"
Expand Down Expand Up @@ -55,6 +56,8 @@ def _get_enabled_features(self, request):
enabled_features.append(FEATURE_LIVE_SETTINGS)
if live_settings.GRAFANA_CLOUD_NOTIFICATIONS_ENABLED:
enabled_features.append(FEATURE_GRAFANA_CLOUD_NOTIFICATIONS)
else:
enabled_features.append(FEATURE_MSTEAMS)

if settings.FEATURE_GRAFANA_ALERTING_V2_ENABLED:
enabled_features.append(FEATURE_GRAFANA_ALERTING_V2)
Expand Down

0 comments on commit 4c8870f

Please sign in to comment.