edx_toggles.toggles package#
Subpackages#
Submodules#
edx_toggles.toggles.testutils module#
Toggle test utilities.
- class edx_toggles.toggles.testutils.override_waffle_flag(flag, active)#
Bases:
override_flagoverride_waffle_flag is a contextmanager for easier testing of flags.
It accepts two parameters, the flag itself and its intended state. Example usage:
with override_waffle_flag(SOME_COURSE_FLAG, active=True): ...
If the flag already exists, its value will be changed inside the context block, then restored to the original value. If the flag does not exist before entering the context, it is created, then removed at the end of the block.
It can also act as a decorator:
@override_waffle_flag(SOME_COURSE_FLAG, active=True) def test_happy_mode_enabled(): ...
- class edx_toggles.toggles.testutils.override_waffle_switch(switch, active)#
Bases:
override_switchOverrides the active value for the given switch for the duration of this contextmanager. Note: The value is overridden in the request cache AND in the model.
Note: The implementation for overriding switches and flags differ.
override_waffle_switchmakes an explicit call toWaffleSwitch.is_enabled, which fills the cache, whileoverride_waffle_flagonly looks at the cached values. It is unclear whether this difference is important, or just due to being developed at different times by different people.
Module contents#
Expose public feature toggle API.