diff options
author | Maciej Wereski <m.wereski@partner.samsung.com> | 2017-08-31 16:11:31 +0200 |
---|---|---|
committer | Maciej Wereski <m.wereski@partner.samsung.com> | 2018-06-05 11:24:40 +0200 |
commit | 3ff7b1c9503b94d9975ea8f9708510950a5f2484 (patch) | |
tree | dfd60cbca86e6aadbc35f2dca98a9a40d11d03ee /mocks | |
parent | 3c4328d544a9cf55f0290dd4be90918140d414d5 (diff) | |
download | boruta-3ff7b1c9503b94d9975ea8f9708510950a5f2484.tar.gz boruta-3ff7b1c9503b94d9975ea8f9708510950a5f2484.tar.bz2 boruta-3ff7b1c9503b94d9975ea8f9708510950a5f2484.zip |
Add HTTP API package
HTTP API package will provide all HTTP API which will be exposed to the
Boruta clients. Only User API counterpart of Boruta is added for now.
Currently the package provides only one function, which takes pointer to
httprouter.Router and registers all paths and HTTP methods in it.
HTTP API module will have a lot of test cases agregated in test tables.
To improve test cases development time and readability of test files,
flag '-update' is added to test. It will run tests and for all
testcases a file with results will be generated in 'testdata'
subdirectory. During testing (running without '-update' flag) those
files are read and compared with results of tested functions.
Generating testcase files:
$ go test git.tizen.org/tools/boruta/server/api/v1 -update
Testing (as usual):
$ go test git.tizen.org/tools/boruta/server/api/v1
After updating testcase files output must be inspected by developer
before commiting to the repository (and should be also checked by
reviewers before merging).
Change-Id: I6d98f093cce116512dc305e07a8614990580faff
Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Diffstat (limited to 'mocks')
-rw-r--r-- | mocks/mock_requests.go | 123 | ||||
-rw-r--r-- | mocks/mock_workers.go | 96 |
2 files changed, 219 insertions, 0 deletions
diff --git a/mocks/mock_requests.go b/mocks/mock_requests.go new file mode 100644 index 0000000..b9ff76f --- /dev/null +++ b/mocks/mock_requests.go @@ -0,0 +1,123 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: git.tizen.org/tools/boruta (interfaces: Requests) + +// Package mocks is a generated GoMock package. +package mocks + +import ( + boruta "git.tizen.org/tools/boruta" + gomock "github.com/golang/mock/gomock" + reflect "reflect" + time "time" +) + +// MockRequests is a mock of Requests interface +type MockRequests struct { + ctrl *gomock.Controller + recorder *MockRequestsMockRecorder +} + +// MockRequestsMockRecorder is the mock recorder for MockRequests +type MockRequestsMockRecorder struct { + mock *MockRequests +} + +// NewMockRequests creates a new mock instance +func NewMockRequests(ctrl *gomock.Controller) *MockRequests { + mock := &MockRequests{ctrl: ctrl} + mock.recorder = &MockRequestsMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockRequests) EXPECT() *MockRequestsMockRecorder { + return m.recorder +} + +// AcquireWorker mocks base method +func (m *MockRequests) AcquireWorker(arg0 boruta.ReqID) (boruta.AccessInfo, error) { + ret := m.ctrl.Call(m, "AcquireWorker", arg0) + ret0, _ := ret[0].(boruta.AccessInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AcquireWorker indicates an expected call of AcquireWorker +func (mr *MockRequestsMockRecorder) AcquireWorker(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcquireWorker", reflect.TypeOf((*MockRequests)(nil).AcquireWorker), arg0) +} + +// CloseRequest mocks base method +func (m *MockRequests) CloseRequest(arg0 boruta.ReqID) error { + ret := m.ctrl.Call(m, "CloseRequest", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// CloseRequest indicates an expected call of CloseRequest +func (mr *MockRequestsMockRecorder) CloseRequest(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseRequest", reflect.TypeOf((*MockRequests)(nil).CloseRequest), arg0) +} + +// GetRequestInfo mocks base method +func (m *MockRequests) GetRequestInfo(arg0 boruta.ReqID) (boruta.ReqInfo, error) { + ret := m.ctrl.Call(m, "GetRequestInfo", arg0) + ret0, _ := ret[0].(boruta.ReqInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetRequestInfo indicates an expected call of GetRequestInfo +func (mr *MockRequestsMockRecorder) GetRequestInfo(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestInfo", reflect.TypeOf((*MockRequests)(nil).GetRequestInfo), arg0) +} + +// ListRequests mocks base method +func (m *MockRequests) ListRequests(arg0 boruta.ListFilter) ([]boruta.ReqInfo, error) { + ret := m.ctrl.Call(m, "ListRequests", arg0) + ret0, _ := ret[0].([]boruta.ReqInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListRequests indicates an expected call of ListRequests +func (mr *MockRequestsMockRecorder) ListRequests(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRequests", reflect.TypeOf((*MockRequests)(nil).ListRequests), arg0) +} + +// NewRequest mocks base method +func (m *MockRequests) NewRequest(arg0 boruta.Capabilities, arg1 boruta.Priority, arg2 boruta.UserInfo, arg3, arg4 time.Time) (boruta.ReqID, error) { + ret := m.ctrl.Call(m, "NewRequest", arg0, arg1, arg2, arg3, arg4) + ret0, _ := ret[0].(boruta.ReqID) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NewRequest indicates an expected call of NewRequest +func (mr *MockRequestsMockRecorder) NewRequest(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewRequest", reflect.TypeOf((*MockRequests)(nil).NewRequest), arg0, arg1, arg2, arg3, arg4) +} + +// ProlongAccess mocks base method +func (m *MockRequests) ProlongAccess(arg0 boruta.ReqID) error { + ret := m.ctrl.Call(m, "ProlongAccess", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// ProlongAccess indicates an expected call of ProlongAccess +func (mr *MockRequestsMockRecorder) ProlongAccess(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProlongAccess", reflect.TypeOf((*MockRequests)(nil).ProlongAccess), arg0) +} + +// UpdateRequest mocks base method +func (m *MockRequests) UpdateRequest(arg0 *boruta.ReqInfo) error { + ret := m.ctrl.Call(m, "UpdateRequest", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateRequest indicates an expected call of UpdateRequest +func (mr *MockRequestsMockRecorder) UpdateRequest(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRequest", reflect.TypeOf((*MockRequests)(nil).UpdateRequest), arg0) +} diff --git a/mocks/mock_workers.go b/mocks/mock_workers.go new file mode 100644 index 0000000..590e252 --- /dev/null +++ b/mocks/mock_workers.go @@ -0,0 +1,96 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: git.tizen.org/tools/boruta (interfaces: Workers) + +// Package mocks is a generated GoMock package. +package mocks + +import ( + boruta "git.tizen.org/tools/boruta" + gomock "github.com/golang/mock/gomock" + reflect "reflect" +) + +// MockWorkers is a mock of Workers interface +type MockWorkers struct { + ctrl *gomock.Controller + recorder *MockWorkersMockRecorder +} + +// MockWorkersMockRecorder is the mock recorder for MockWorkers +type MockWorkersMockRecorder struct { + mock *MockWorkers +} + +// NewMockWorkers creates a new mock instance +func NewMockWorkers(ctrl *gomock.Controller) *MockWorkers { + mock := &MockWorkers{ctrl: ctrl} + mock.recorder = &MockWorkersMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockWorkers) EXPECT() *MockWorkersMockRecorder { + return m.recorder +} + +// Deregister mocks base method +func (m *MockWorkers) Deregister(arg0 boruta.WorkerUUID) error { + ret := m.ctrl.Call(m, "Deregister", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Deregister indicates an expected call of Deregister +func (mr *MockWorkersMockRecorder) Deregister(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Deregister", reflect.TypeOf((*MockWorkers)(nil).Deregister), arg0) +} + +// GetWorkerInfo mocks base method +func (m *MockWorkers) GetWorkerInfo(arg0 boruta.WorkerUUID) (boruta.WorkerInfo, error) { + ret := m.ctrl.Call(m, "GetWorkerInfo", arg0) + ret0, _ := ret[0].(boruta.WorkerInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetWorkerInfo indicates an expected call of GetWorkerInfo +func (mr *MockWorkersMockRecorder) GetWorkerInfo(arg0 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetWorkerInfo", reflect.TypeOf((*MockWorkers)(nil).GetWorkerInfo), arg0) +} + +// ListWorkers mocks base method +func (m *MockWorkers) ListWorkers(arg0 boruta.Groups, arg1 boruta.Capabilities) ([]boruta.WorkerInfo, error) { + ret := m.ctrl.Call(m, "ListWorkers", arg0, arg1) + ret0, _ := ret[0].([]boruta.WorkerInfo) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListWorkers indicates an expected call of ListWorkers +func (mr *MockWorkersMockRecorder) ListWorkers(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListWorkers", reflect.TypeOf((*MockWorkers)(nil).ListWorkers), arg0, arg1) +} + +// SetGroups mocks base method +func (m *MockWorkers) SetGroups(arg0 boruta.WorkerUUID, arg1 boruta.Groups) error { + ret := m.ctrl.Call(m, "SetGroups", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetGroups indicates an expected call of SetGroups +func (mr *MockWorkersMockRecorder) SetGroups(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetGroups", reflect.TypeOf((*MockWorkers)(nil).SetGroups), arg0, arg1) +} + +// SetState mocks base method +func (m *MockWorkers) SetState(arg0 boruta.WorkerUUID, arg1 boruta.WorkerState) error { + ret := m.ctrl.Call(m, "SetState", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// SetState indicates an expected call of SetState +func (mr *MockWorkersMockRecorder) SetState(arg0, arg1 interface{}) *gomock.Call { + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*MockWorkers)(nil).SetState), arg0, arg1) +} |