def get_with_index_calls_get_with_id_from_list(self):
        ''' Revision(index=-2).get() calls request with -2th id of revisions '''
        # save
        o_revision_list = springnote.Revision.list

        page    = self.page
        index   = -2
        id      = 4567
        verbose = True
        
        rev1 = Revision(parent=page, id=id)
        rev2 = Revision(parent=page, id=id+1)
        rev1.date_created = 1
        rev2.date_created = 2
        springnote.Revision.list = lambda *args, **kwarg: [rev2, rev1]

        # calls revision.get()
        rev = Revision(parent=page, index=index)
        run = lambda: rev.get(verbose=verbose)
        url = "/pages/%d/revisions/%d." % (page.id, id)
        should_call_method(springnote.Revision, 'request', when=run,
            arg=with_at_least(eq(rev), contains_string(url), verbose=eq(verbose)))

        # restore
        springnote.Revision.list = o_revision_list
    def should_have_parent_id_and_one_of_index_or_id_and_parent_id(self):
        ''' Revision.get() without parent.id or (id|index) raises exception '''
        # (parent.id, id) is okay
        rev = Revision(self.page, id=3)
        should_call_method(springnote.Revision, 'request', when=lambda: rev.get())

        # (parent.id, index) is okay
        rev = Revision(self.page, index=-3)
        should_call_method(springnote.Revision, 'list', when=lambda: rev.get())

        # (parent.id=None, id or index) is NOT okay
        idless_page = springnote.Page(self.page.auth, None) 
        pageid_less_rev = springnote.Revision(idless_page, id=123)
        should_raise(springnote.SpringnoteError.InvalidOption, 
                    when=lambda: pageid_less_rev.get())

        # (parent.id, id=None, index=None) is NOT okay
        id_less_rev = springnote.Revision(self.page, id=None, index=None)
        should_raise(springnote.SpringnoteError.InvalidOption, 
                    when=lambda: id_less_rev.get())
    def get_with_index_calls_list(self):
        ''' Revision(index=-2).get() calls list() and request() with index id '''
        index   = -2
        verbose = True
        rev     = Revision(parent=self.page, index=index)
        run = lambda: rev.get(verbose=verbose)

        # calls Revision.list
        should_call_method(springnote.Revision, 'list', when=run,
            arg=with_(eq(springnote.Revision), eq(self.page), verbose=eq(verbose)),
            method_type=classmethod,
        )