Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-508: Add UNLISTED_ICON_SETS environment so we can unlist some sets on different staging #88

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/icon_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from app.settings import COLORABLE_ICON_SETS
from app.settings import ICON_SET_LANGUAGE
from app.settings import IMAGE_FOLDER
from app.settings import LEGACY_ICON_SETS
from app.settings import UNLISTED_ICON_SETS


def get_icon_set(icon_set_name):
Expand All @@ -32,7 +32,7 @@ def get_all_icon_sets():
for root, dirs, files in os.walk(IMAGE_FOLDER):
for icon_set_name in dirs:
# icons of legacy icon sets are still available, but the icon set will not be listed
if icon_set_name not in LEGACY_ICON_SETS:
if icon_set_name not in UNLISTED_ICON_SETS:
icon_sets.append(get_icon_set(icon_set_name))
return icon_sets

Expand Down
4 changes: 3 additions & 1 deletion app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
)

COLORABLE_ICON_SETS = ['default']
LEGACY_ICON_SETS = ['babs']
LEGACY_ICON_SETS = []
UNRELEASED_ICON_SETS = ['babs-de', 'babs-fr', 'babs-it']
ltshb marked this conversation as resolved.
Show resolved Hide resolved
UNLISTED_ICON_SETS = LEGACY_ICON_SETS + UNRELEASED_ICON_SETS
ICON_SET_LANGUAGE = {'babs-de': 'de', 'babs-fr': 'fr', 'babs-it': 'it'}
DEFAULT_COLOR = {"r": '255', "g": '0', "b": '0'}
DEFAULT_ICON_SIZE = 48
Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/test_all_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from app.settings import COLORABLE_ICON_SETS
from app.settings import DEFAULT_ICON_SIZE
from app.settings import IMAGE_FOLDER
from app.settings import LEGACY_ICON_SETS
from app.settings import UNLISTED_ICON_SETS
from tests.unit_tests.base_test import ServiceIconsUnitTests


Expand Down Expand Up @@ -159,11 +159,11 @@ def test_all_icon_sets_endpoint(self):
self.assertTrue(response.json['items'])
icon_sets_from_endpoint = response.json['items']
self.assertEqual(
len(icon_sets_from_endpoint), len(self.all_icon_sets) - len(LEGACY_ICON_SETS)
len(icon_sets_from_endpoint), len(self.all_icon_sets) - len(UNLISTED_ICON_SETS)
)
for legacy_icon_set in LEGACY_ICON_SETS:
for unlisted_icon_set in UNLISTED_ICON_SETS:
self.assertNotIn(
legacy_icon_set, icon_sets_from_endpoint, msg="Icon set should not be listed"
unlisted_icon_set, icon_sets_from_endpoint, msg="Icon set should not be listed"
)
for icon_set in icon_sets_from_endpoint:
self.assertIn('name', icon_set)
Expand Down