Skip to content

Commit

Permalink
Use updated API /feature_flags_state/
Browse files Browse the repository at this point in the history
  • Loading branch information
zkayyali812 committed Jan 29, 2025
1 parent 6d961d2 commit 90339dc
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion awx/main/tests/functional/test_feature_flags_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import pytest
from django.test import override_settings

from awx.main.models import ( # noqa
User,
Expand All @@ -10,6 +11,28 @@
def test_feature_flags_list_endpoint(get):
bob = User.objects.create(username='bob', password='test_user', is_superuser=False)

url = "/api/v2/feature_flags_definition/"
url = "/api/v2/feature_flags_state/"
response = get(url, user=bob, expect=200)
assert len(response.data) == 1


@override_settings(
FLAGS={
"FEATURE_SOME_PLATFORM_FLAG_ENABLED": [
{"condition": "boolean", "value": False},
{"condition": "before date", "value": "2022-06-01T12:00Z"},
],
"FEATURE_SOME_PLATFORM_FLAG_FOO_ENABLED": [
{"condition": "boolean", "value": True},
],
}
)
@pytest.mark.django_db
def test_feature_flags_list_endpoint_override(get):
bob = User.objects.create(username='bob', password='test_user', is_superuser=False)

url = "/api/v2/feature_flags_state/"
response = get(url, user=bob, expect=200)
assert len(response.data) == 2
assert response.data["FEATURE_SOME_PLATFORM_FLAG_ENABLED"] is False
assert response.data["FEATURE_SOME_PLATFORM_FLAG_FOO_ENABLED"] is True

0 comments on commit 90339dc

Please sign in to comment.