Пример #1
0
def local_store_persists_data(pickle_dump):
    note_store = get_note_store()
    note_store.listNotebooks.__name__ = 'listNotebooks'
    def listNotebooks(*args, **kwargs):
        return []
    note_store.listNotebooks.func_code = listNotebooks.func_code

    local_note_store = LocalNoteStore(note_store, Mock())
    local_note_store.listNotebooks()
    local_note_store = LocalNoteStore(note_store, Mock())
    local_note_store.listNotebooks()

    assert_equal(note_store.listNotebooks.call_count, 1)
Пример #2
0
def local_store_wraps_edam_note_store(pickle_dump, marshal_dump):
    note_store = get_note_store()
    changed_function = Mock(return_value=1)
    local_note_store = LocalNoteStore(note_store, changed_function)

    local_note_store.listNotebooks()
    local_note_store.listNotebooks()
    
    assert_equal(note_store.listNotebooks.call_count, 1)
    changed_function.return_value = 2

    local_note_store.listNotebooks()
    local_note_store.listNotebooks()

    assert_equal(note_store.listNotebooks.call_count, 2)