'Assert that an API method was just called.'

def assert_called(self, method, url, body=None, pos=(-1)):

    expected = (method, url)
    called = self.client.callstack[pos][0:2]
    assert self.client.callstack, ('Expected    %s    %s    but    no    calls    were    made.' % expected)
    assert (expected == called), ('Expected    %s    %s;    got    %s    %s' % (expected + called))
    if (body is not None):
        assert (self.client.callstack[pos][2] == body)
