def test_delete_auto_auth_users(self): # Create an auto-auth user username = password = settings.AUTO_AUTH_USERNAME_PREFIX + uuid.uuid4().hex[0:20] User.objects.create_user(username, password=password) user_count = User.objects.count() # Call a command that should remove all auto-auth users delete_auto_auth_users() # Verify the user has been removed self.assertEqual(User.objects.count(), user_count - 1)
def handle(self, *args, **options): delete_auto_auth_users()