'rpcs is a list of tuples, each representing one RPC:
(op, **dargs, success, expected)'

def mock_rpcs(self, rpcs):

    for (op, dargs, success, expected) in rpcs:
        comm = rpc.afe_comm.run
        if success:
            comm.expect_call(op, **dargs).and_return(expected)
        else:
            comm.expect_call(op, **dargs).and_raises(proxy.JSONRPCException(expected))
