Skip to content

Commit

Permalink
test:toggle methods' testcase in BaseWaffleTest class
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo-flux committed Aug 17, 2023
1 parent ce556a8 commit c370991
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions edx_toggles/tests/test_waffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ def test_constructor(self):
self.assertEqual("module1", waffle.module_name)
self.assertEqual(1, len(NaiveWaffle.get_instances()))

def test_toggle_methods(self):
waffle = NaiveWaffle("namespaced.name", "module1")
# test is_enabled method
self.assertEqual(True, waffle.is_enabled())
#test is_disabled method
self.assertEqual(False, waffle.is_disabled())
#test is_toggle_on method
self.assertEqual(waffle.is_enabled(), waffle.is_toggle_on())
#test is_toggle_off method
self.assertEqual(waffle.is_disabled(), waffle.is_toggle_off())


class WaffleFlagTests(TestCase):
"""
Expand Down
2 changes: 1 addition & 1 deletion edx_toggles/toggles/internal/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_instances(cls):
"""
return sorted(cls._class_instances, key=lambda instance: instance.name)

def is_disabed(self):
def is_disabled(self):
return not self.is_enabled()

def is_toggle_on(self):
Expand Down

0 comments on commit c370991

Please sign in to comment.