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 c2aaed8 commit 1743bb7
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)

Check warning on line 12 in awx/main/tests/functional/test_feature_flags_api.py

View check run for this annotation

Codecov / codecov/patch

awx/main/tests/functional/test_feature_flags_api.py#L12

Added line #L12 was not covered by tests

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

Check warning on line 16 in awx/main/tests/functional/test_feature_flags_api.py

View check run for this annotation

Codecov / codecov/patch

awx/main/tests/functional/test_feature_flags_api.py#L14-L16

Added lines #L14 - L16 were not covered by tests


@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)

Check warning on line 32 in awx/main/tests/functional/test_feature_flags_api.py

View check run for this annotation

Codecov / codecov/patch

awx/main/tests/functional/test_feature_flags_api.py#L32

Added line #L32 was not covered by tests

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

Check warning on line 38 in awx/main/tests/functional/test_feature_flags_api.py

View check run for this annotation

Codecov / codecov/patch

awx/main/tests/functional/test_feature_flags_api.py#L34-L38

Added lines #L34 - L38 were not covered by tests

0 comments on commit 1743bb7

Please sign in to comment.