Utilize mock backup handler
This commit is contained in:
parent
c13f70ecc7
commit
30e9439287
@ -613,7 +613,8 @@ type mockURLCache struct {
|
||||
|
||||
func (muc *mockURLCache) getItemProperties(
|
||||
ctx context.Context,
|
||||
itemID string) (itemProps, error) {
|
||||
itemID string,
|
||||
) (itemProps, error) {
|
||||
return muc.Get(ctx, itemID)
|
||||
}
|
||||
|
||||
|
||||
@ -391,7 +391,6 @@ func (c *Collections) Get(
|
||||
err = c.addURLCacheToDriveCollections(
|
||||
ictx,
|
||||
driveID,
|
||||
c.handler.ItemPager(driveID, "", api.DriveItemSelectDefault()),
|
||||
errs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -459,17 +458,18 @@ func (c *Collections) Get(
|
||||
return collections, canUsePreviousBackup, nil
|
||||
}
|
||||
|
||||
// addURLCacheToDriveCollections adds a URL cache to all collections belonging to
|
||||
// a drive.
|
||||
func (c *Collections) addURLCacheToDriveCollections(
|
||||
ctx context.Context,
|
||||
driveID string,
|
||||
pager api.DriveItemEnumerator,
|
||||
errs *fault.Bus,
|
||||
) error {
|
||||
uc, err := newURLCache(
|
||||
driveID,
|
||||
urlCacheRefreshInterval,
|
||||
errs,
|
||||
pager)
|
||||
c.handler.ItemPager(driveID, "", api.DriveItemSelectDefault()))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -2692,7 +2692,6 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() {
|
||||
prevDelta string
|
||||
err error
|
||||
}{
|
||||
|
||||
{
|
||||
name: "cache is attached",
|
||||
},
|
||||
@ -2704,8 +2703,11 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() {
|
||||
ctx, flush := tester.NewContext()
|
||||
defer flush()
|
||||
|
||||
mbh := mock.DefaultOneDriveBH()
|
||||
mbh.ItemPagerV = map[string]api.DriveItemEnumerator{}
|
||||
|
||||
c := NewCollections(
|
||||
&itemBackupHandler{api.Drives{}},
|
||||
mbh,
|
||||
"test-tenant",
|
||||
"test-user",
|
||||
testFolderMatcher{(&selectors.OneDriveBackup{}).Folders(selectors.Any())[0]},
|
||||
@ -2737,7 +2739,6 @@ func (suite *OneDriveCollectionsUnitSuite) TestURLCacheIntegration() {
|
||||
err := c.addURLCacheToDriveCollections(
|
||||
ctx,
|
||||
driveID,
|
||||
&mockItemPager{},
|
||||
fault.New(true))
|
||||
|
||||
require.NoError(t, err, clues.ToCore(err))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user