From e0bf273e35172fc838a8c0e80c79fbf19ffb3107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Sat, 6 Apr 2019 00:16:58 +0200 Subject: [PATCH] added test for SynchronizeCategories --- internal/pkg/category/category_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/pkg/category/category_test.go b/internal/pkg/category/category_test.go index b0eabcd..d5a0e4d 100644 --- a/internal/pkg/category/category_test.go +++ b/internal/pkg/category/category_test.go @@ -279,6 +279,25 @@ func Test_getParentId_finds_the_exptected_parent_id(t *testing.T) { } } +func Test_SynchronizeCategories(t *testing.T) { + mockCtrl := gomock.NewController(t) + defer mockCtrl.Finish() + + fileSystemNodes := make(map[string]*localFileStructure.FilesystemNode) + + dbmock := NewMockCategoryProvider(mockCtrl) + dbmock.EXPECT().GetCategoriesToCreate().Times(1) + + piwigoMock := NewMockPiwigoCategoryApi(mockCtrl) + piwigoMock.EXPECT().GetAllCategories().Times(1) + + err := SynchronizeCategories(fileSystemNodes, piwigoMock, dbmock) + if err != nil { + t.Error(err) + } + +} + func createDbRootCategory() datastore.CategoryData { parentCategory := datastore.CategoryData{ PiwigoId: 1,