"""Test for restricted_features in account/constants/features.py.""" import pytest from account.constants.features import BRAND_TO_RESTRICTED_FEATURES, FEATURES, restricted_features @pytest.mark.parametrize( ('brand', 'expected'), [ pytest.param( 'awal', [ 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'awal': remove AWAL_ENABLED_FEATURES from the full set", ), pytest.param( 'knr', [ 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'knr': no enabled features provided, so all features are restricted", ), pytest.param( 'altafonte', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'altafonte': remove ALTAFONTE_ENABLED_FEATURES from the full set", ), pytest.param( 'sme', [ 3, 4, 6, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'sme': no enabled features provided, so all features are restricted", ), pytest.param( 'theorchard', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'theorchard': remove THEORCHARD_ENABLED_FEATURES from the full set", ), pytest.param( 'hrs', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'hrs': remove THEORCHARD_ENABLED_FEATURES from the full set", ), pytest.param( 'msk', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'msk': remove THEORCHARD_ENABLED_FEATURES from the full set", ), pytest.param( 'ab', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'ab': remove THEORCHARD_ENABLED_FEATURES from the full set", ), pytest.param( 'drm', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'drm': remove THEORCHARD_ENABLED_FEATURES from the full set", ), pytest.param( 'ma', [ 3, 4, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'ma': remove THEORCHARD_ENABLED_FEATURES from the full set", ), pytest.param( 'foundation', [ 3, 4, 6, 7, 10, 11, 12, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, ], id="For 'foundation': remove FOUNDATION_ENABLED_FEATURES from the full set", ), ], ) def test_brand_to_restricted_features_constant(brand: str, expected: list[int]) -> None: assert BRAND_TO_RESTRICTED_FEATURES[brand] == expected def test_restricted_features() -> None: enabled_features = { FEATURES.FANSIFTER, FEATURES.FANSIFTER_AD_REPORTING, FEATURES.FANSIFTER_AD_CAMPAIGN_AUDIENCES, FEATURES.FANSIFTER_EMAIL_CAMPAIGNS, FEATURES.FANSIFTER_SMS_CAMPAIGNS, FEATURES.FANSIFTER_GLOBAL_FAN_DATA_LISTS, } expected = [ 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 42, 43, 44, ] assert restricted_features(enabled_features) == expected