def claim_rewards(steem, account_name):
    logger.info('Logged In. Checking for rewards.')
    account = steem.get_account(account_name)
    rewards = reward_available(account)
    if rewards:
        logger.info('Claiming rewards.')
        commit = Commit(steem)
        commit.claim_reward_balance(account=account_name)
        logger.info(
            'Rewards are claimed. %s STEEM, %s SBD, %s VESTS',
            rewards["steem"],
            rewards["sbd"],
            rewards["vesting"],
        )
def test_claim_reward():
    wif = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
    c = Commit(steemd_instance=Steemd(nodes=[]), keys=[wif])

    rpc_error = None
    try:
        c.claim_reward_balance(account='test',
                               reward_steem='1.000 STEEM',
                               reward_vests='0.000000 VESTS',
                               reward_sbd='0.000 SBD')
    except RPCError as e:
        rpc_error = str(e)
    else:
        raise Exception('expected RPCError')

    assert 'tx_missing_posting_auth' in rpc_error