Пример #1
0
def get_account_summary(context):
    """ Test calling the RetirementServices.get_account_summary method """
    with mock_benefits_requests(context):
        try:
            retirement = context.benefits_online.retirement_services
            assert retirement.get_account_summary()
        except PychexUnauthenticatedError:
            context.exceptions.append(sys.exc_info()[1])
Пример #2
0
def _login(context, logging_into, password=None, http_status=200):
    """ Call the login method of the specified type of object """
    with mock_login_requests(context):
        with mock_benefits_requests(context, http_status):
            try:
                if logging_into == 'paychex':
                    assert context.paychex.login(password)
                elif logging_into == 'benefits_online':
                    context.benefits_online.password = password
                    assert context.benefits_online.login()
                else:
                    assert context.benefits_online.retirement_services.login()
            except (PychexInvalidPasswordError, PychexUnknownError,
                    PychexSecurityImageMissingError):
                context.exceptions.append(sys.exc_info()[1])
Пример #3
0
Файл: cli.py Проект: brad/pychex
def run_account_summary(context, json=False):
    # Make sure the password check passes in the paychex_login mock
    context.paychex = MagicMock()
    context.paychex.password = context.password
    # Reset the stdout capture
    context.stdout_capture.truncate(0)
    context.stdout_capture.seek(0)

    with mock_login_requests(context):
        mock_obj = ContextXmlMock(context)
        with mock_request(context, mock_obj.paychex_account_data):
            with mock_benefits_requests(context):
                arguments = {
                    'authorize': False,
                    'account_summary': True,
                    '--config': context.config_file,
                    '--json': json
                }
                try:
                    PychexCli(arguments)
                except Exception:
                    assert False, 'Exception: %s' % sys.exc_info()[1]