diff --git a/waffle/management/commands/waffle_flag.py b/waffle/management/commands/waffle_flag.py index cdf9c374..839cef27 100644 --- a/waffle/management/commands/waffle_flag.py +++ b/waffle/management/commands/waffle_flag.py @@ -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', diff --git a/waffle/tests/test_management.py b/waffle/tests/test_management.py index 2597b3d8..a70f3717 100644 --- a/waffle/tests/test_management.py +++ b/waffle/tests/test_management.py @@ -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)