-
Notifications
You must be signed in to change notification settings - Fork 19
/
updater.go
37 lines (30 loc) · 1.06 KB
/
updater.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* UpdateHub
* Copyright (C) 2017
* O.S. Systems Sofware LTDA: contato@ossystems.com.br
*
* SPDX-License-Identifier: Apache-2.0
*/
package updatermock
import (
"io"
"time"
"github.com/UpdateHub/updatehub/client"
"github.com/anacrolix/missinggo/httptoo"
"github.com/stretchr/testify/mock"
)
type UpdaterMock struct {
mock.Mock
}
func (um *UpdaterMock) ProbeUpdate(api client.ApiRequester, uri string, data interface{}) (interface{}, []byte, time.Duration, error) {
args := um.Called(api, uri, data)
return args.Get(0), args.Get(1).([]byte), args.Get(2).(time.Duration), args.Error(3)
}
func (um *UpdaterMock) DownloadUpdate(api client.ApiRequester, uri string, cr *httptoo.BytesContentRange) (io.ReadCloser, int64, error) {
args := um.Called(api, uri)
return args.Get(0).(io.ReadCloser), args.Get(1).(int64), args.Error(2)
}
func (um *UpdaterMock) GetUpdateContentRange(api client.ApiRequester, uri string, start int64) (*httptoo.BytesContentRange, error) {
args := um.Called(api, uri, start)
return args.Get(0).(*httptoo.BytesContentRange), args.Error(1)
}