fix #9484 bug(nimbus): re enable disabled features (#9485)

Because

* When a feature is removed from the manifest it is then marked disabled
and unable to be used
* If a feature is removed from a manifest and later re-added, it will
not re-enable and be usable

This commit

* Re-enables disabled features if they are re-added to a manifest
This commit is contained in:
Jared Lockhart 2023-09-22 11:46:56 -04:00 коммит произвёл GitHub
Родитель 29c56a05e3
Коммит 86d52c0c6d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -29,6 +29,7 @@ class Command(BaseCommand):
defaults={
"name": feature.slug,
"description": feature.description,
"enabled": True,
},
)

Просмотреть файл

@ -208,6 +208,24 @@ class TestLoadFeatureConfigs(TestCase):
self.assertTrue(feature_desktop.enabled)
self.assertFalse(feature_fenix.enabled)
def test_load_feature_sets_enabled_to_true_if_disabled_and_found_in_yaml(self):
NimbusFeatureConfigFactory.create(
slug="someFeature",
application=NimbusExperiment.Application.DESKTOP,
schemas=[
NimbusVersionedSchemaFactory.build(
version=None,
schema="{}",
)
],
enabled=False,
)
call_command("load_feature_configs")
feature_config = NimbusFeatureConfig.objects.get(slug="someFeature")
self.assertTrue(feature_config.enabled)
@mock_invalid_remote_schema_features
class TestLoadInvalidRemoteSchemaFeatureConfigs(TestCase):
@ -235,7 +253,6 @@ class TestLoadInvalidRemoteSchemaFeatureConfigs(TestCase):
self.assertEqual(feature_config.schemas.get(version=None).schema, schema)
def test_load_feature_does_not_set_no_features_slug_enabled_to_false(self):
call_command("load_feature_configs")
feature_config = NimbusFeatureConfig.objects.get(slug="no-feature-fenix")