def wrapper(profile_name, *args, **kwargs):
     profile_name = profile_name or profile_utils.DEFAULT_PROFILE_NAME
     keyargs, removal, formatargs = profile_utils.get_auth_check_and_removal(funcname, profile_name)
     if kwargs:
         kwargs.update(keyargs)
     else:
         kwargs = keyargs
     if removal:
         prompt.show_auth_login_msg(formatargs)
     f = func(profile_name, *args, **kwargs)
     if removal:
         for rem in removal:
             profile_utils.remove_profile_value(profile.NAME, rem)
     return f
 def test_get_auth_check_and_removal(self, mocker, func, auth_name):
     mp = mocker.MagicMock()
     if auth_name:
         for name in auth_name:
             setattr(mp, name, True)
         if len(auth_name) == 1 and 'USERNAME' in auth_name:
             mp.PASSWORD = None
     mocker.patch('picovico.cli.profile_utils.get_auth_names', return_value=auth_name)
     mocker.patch('picovico.cli.profile_utils.get_profile', return_value=mp)
     kargs, rem, names  = profile_utils.get_auth_check_and_removal(func, default_section_name)
     if auth_name is None:
         assert all(k in kargs and kargs[k] for k in ('do_prompt', 'profile'))
         assert rem is None
     else:
         assert any(k.lower() in kargs and kargs[k.lower()] for k in auth_name)
         rem_check = 'APP_SECRET' if func == 'login' else 'USERNAME'
         assert rem == rem_check
         assert names.index(func)
     assert all(k in names for k in self._funcs)