'Verify the state of the latest query.
Return the id of that query'

def _verify_query_state(self, state, *extra_states):

    resp = self.client.get('/beeswax/query_history')
    history = resp.context['page'].object_list[0]
    last_state = history.last_state
    assert_true((beeswax.models.QueryHistory.STATE[last_state] in ((state,) + extra_states)))
    return history.id
