class SettingsFeatureCheckerTests(TestCase): """Unit tests for djblets.features.checkers.SettingsFeatureChecker.""" def setUp(self): super(SettingsFeatureCheckerTests, self).setUp() self.checker = SettingsFeatureChecker() def tearDown(self): super(SettingsFeatureCheckerTests, self).tearDown() try: delattr(settings, 'ENABLED_FEATURES') except AttributeError: pass def test_is_feature_enabled_with_enabled(self): """Testing SettingsFeatureChecker.is_feature_enabled with feature enabled """ settings.ENABLED_FEATURES = { 'my-feature': True, } self.assertTrue(self.checker.is_feature_enabled('my-feature')) def test_is_feature_enabled_with_disabled(self): """Testing SettingsFeatureChecker.is_feature_enabled with feature disabled """ settings.ENABLED_FEATURES = { 'my-feature': False, } self.assertFalse(self.checker.is_feature_enabled('my-feature')) def test_is_feature_enabled_with_unset(self): """Testing SettingsFeatureChecker.is_feature_enabled with feature state not set """ self.assertFalse(self.checker.is_feature_enabled('my-feature'))
def setUp(self): super(SettingsFeatureCheckerTests, self).setUp() self.checker = SettingsFeatureChecker()