Allow omission of course_key in call to CourseWaffleFlag.is_enabled

This effectively evaluates the flag outside of the context of a course.
This was previously available through `.is_enabled_without_course_context`,
which has been removed in favor of simply `is_enabled()`.

This was done to make the CourseWaffleFlag interface more uniform with
that of WaffleFlag and ExperimentWaffleFlag and eliminate unecessary
branching when handling CourseWaffleFlags.
This commit is contained in:
Kyle McCormick
2020-08-07 15:25:22 -04:00
committed by Kyle McCormick
parent b05948153a
commit 662388c7db
3 changed files with 12 additions and 41 deletions

View File

@@ -137,11 +137,9 @@ class ExperimentWaffleFlagTests(SharedModuleStoreTestCase):
def test_is_enabled(self):
with patch('experiments.flags.ExperimentWaffleFlag.get_bucket', return_value=1):
self.assertEqual(self.flag.is_enabled_without_course_context(), True)
self.assertEqual(self.flag.is_enabled(self.key), True)
self.assertEqual(self.flag.is_enabled(), True)
with patch('experiments.flags.ExperimentWaffleFlag.get_bucket', return_value=0):
self.assertEqual(self.flag.is_enabled_without_course_context(), False)
self.assertEqual(self.flag.is_enabled(self.key), False)
self.assertEqual(self.flag.is_enabled(), False)