added test for SynchronizeCategories

This commit is contained in:
Philipp Häfelfinger 2019-04-06 00:16:58 +02:00
parent a3b3cc5b2c
commit e0bf273e35

View File

@ -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 { func createDbRootCategory() datastore.CategoryData {
parentCategory := datastore.CategoryData{ parentCategory := datastore.CategoryData{
PiwigoId: 1, PiwigoId: 1,