'Ensure that the \'staff\' and \'superuser\' bits are set according to the
presence / absence of the associated command options, regardless of
any previous state.'

@ddt.data(*itertools.product([(True, True), (True, False), (False, True), (False, False)], repeat=2))
@ddt.unpack
def test_bits(self, initial_bits, expected_bits):

    (initial_staff, initial_super) = initial_bits
    User.objects.create(username=TEST_USERNAME, email=TEST_EMAIL, is_staff=initial_staff, is_superuser=initial_super)
    (expected_staff, expected_super) = expected_bits
    args = [opt for (bit, opt) in ((expected_staff, '--staff'), (expected_super, '--superuser')) if bit]
    call_command('manage_user', TEST_USERNAME, TEST_EMAIL, *args)
    user = User.objects.all().first()
    self.assertEqual(user.is_staff, expected_staff)
    self.assertEqual(user.is_superuser, expected_super)
