Skip to content

Commit

Permalink
Add --testing option to waffle_flag mgmt command (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmmmcs authored Dec 11, 2023
1 parent 21d7fad commit 80f5b33
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions waffle/management/commands/waffle_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ def add_arguments(self, parser: CommandParser) -> None:
dest='rollout',
default=False,
help='Turn on rollout mode.')
parser.add_argument(
'--testing', '-t',
action='store_true',
dest='testing',
default=False,
help='Turn on testing mode, allowing the flag to be specified via '
'a querystring parameter.')
parser.add_argument(
'--create',
action='store_true',
Expand Down
3 changes: 2 additions & 1 deletion waffle/tests/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ def test_create(self):
name = 'test'
percent = 20
Group.objects.create(name='waffle_group')
call_command('waffle_flag', name, percent=percent,
call_command('waffle_flag', name, percent=percent, testing=True,
superusers=True, staff=True, authenticated=True,
rollout=True, create=True, group=['waffle_group'])

flag = get_waffle_flag_model().objects.get(name=name)
self.assertEqual(flag.percent, percent)
self.assertIsNone(flag.everyone)
self.assertTrue(flag.testing)
self.assertTrue(flag.superusers)
self.assertTrue(flag.staff)
self.assertTrue(flag.authenticated)
Expand Down

0 comments on commit 80f5b33

Please sign in to comment.