From 2abda754040b4c23f9c7e2b3bf14a0f9890365aa Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 28 Mar 2015 16:42:35 +0100 Subject: [PATCH] Refactor mockBackend for test --- backend/generic_test.go | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/backend/generic_test.go b/backend/generic_test.go index d6aee96cf..c45a4c8b6 100644 --- a/backend/generic_test.go +++ b/backend/generic_test.go @@ -2,7 +2,6 @@ package backend_test import ( "fmt" - "io" "path/filepath" "reflect" "runtime" @@ -48,48 +47,13 @@ func str2id(s string) backend.ID { } type mockBackend struct { - list func(backend.Type, <-chan struct{}) <-chan string - get func(backend.Type, backend.ID) ([]byte, error) - getReader func(backend.Type, backend.ID) (io.ReadCloser, error) - create func(backend.Type, []byte) (backend.ID, error) - createFrom func(backend.Type, io.Reader) (backend.ID, error) - test func(backend.Type, backend.ID) (bool, error) - remove func(backend.Type, backend.ID) error - close func() error + list func(backend.Type, <-chan struct{}) <-chan string } func (m mockBackend) List(t backend.Type, done <-chan struct{}) <-chan string { return m.list(t, done) } -func (m mockBackend) Get(t backend.Type, id backend.ID) ([]byte, error) { - return m.get(t, id) -} - -func (m mockBackend) GetReader(t backend.Type, id backend.ID) (io.ReadCloser, error) { - return m.getReader(t, id) -} - -func (m mockBackend) Create(t backend.Type, data []byte) (backend.ID, error) { - return m.create(t, data) -} - -func (m mockBackend) CreateFrom(t backend.Type, r io.Reader) (backend.ID, error) { - return m.createFrom(t, r) -} - -func (m mockBackend) Test(t backend.Type, id backend.ID) (bool, error) { - return m.test(t, id) -} - -func (m mockBackend) Remove(t backend.Type, id backend.ID) error { - return m.remove(t, id) -} - -func (m mockBackend) Close() error { - return m.close() -} - var samples = backend.IDs{ str2id("20bdc1402a6fc9b633aaffffffffffffffffffffffffffffffffffffffffffff"), str2id("20bdc1402a6fc9b633ccd578c4a92d0f4ef1a457fa2e16c596bc73fb409d6cc0"),