"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"oransc.org/usecase/oruclosedloop/internal/repository"
+ repomock "oransc.org/usecase/oruclosedloop/internal/repository/mocks"
+ "oransc.org/usecase/oruclosedloop/internal/restclient/mocks"
"oransc.org/usecase/oruclosedloop/internal/ves"
- "oransc.org/usecase/oruclosedloop/mocks"
)
func Test_MessagesHandlerWithLinkFailure(t *testing.T) {
StatusCode: http.StatusOK,
}, nil)
- lookupServiceMock := mocks.LookupService{}
+ lookupServiceMock := repomock.LookupService{}
lookupServiceMock.On("GetODuID", mock.Anything).Return("O-DU-1122", nil)
log.SetOutput(os.Stderr)
}()
- lookupServiceMock := mocks.LookupService{}
+ lookupServiceMock := repomock.LookupService{}
lookupServiceMock.On("GetODuID", mock.Anything).Return("O-DU-1122", nil)
log.SetOutput(os.Stderr)
}()
- lookupServiceMock := mocks.LookupService{}
+ lookupServiceMock := repomock.LookupService{}
lookupServiceMock.On("GetODuID", mock.Anything).Return("", repository.IdNotMappedError{
Id: "ERICSSON-O-RU-11220",
"os"
)
+//go:generate mockery --name CsvFileHelper
type CsvFileHelper interface {
GetCsvFromFile(name string) ([][]string, error)
}
return fmt.Sprintf("O-RU-ID: %v not mapped.", inme.Id)
}
+//go:generate mockery --name LookupService
type LookupService interface {
Init() error
GetODuID(oRuId string) (string, error)
"testing"
"github.com/stretchr/testify/require"
- "oransc.org/usecase/oruclosedloop/mocks"
+ "oransc.org/usecase/oruclosedloop/internal/repository/mocks"
)
func TestIdNotMappedError(t *testing.T) {
--- /dev/null
+// Code generated by mockery v1.0.0. DO NOT EDIT.
+
+package mocks
+
+import mock "github.com/stretchr/testify/mock"
+
+// CsvFileHelper is an autogenerated mock type for the CsvFileHelper type
+type CsvFileHelper struct {
+ mock.Mock
+}
+
+// GetCsvFromFile provides a mock function with given fields: name
+func (_m *CsvFileHelper) GetCsvFromFile(name string) ([][]string, error) {
+ ret := _m.Called(name)
+
+ var r0 [][]string
+ if rf, ok := ret.Get(0).(func(string) [][]string); ok {
+ r0 = rf(name)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).([][]string)
+ }
+ }
+
+ var r1 error
+ if rf, ok := ret.Get(1).(func(string) error); ok {
+ r1 = rf(name)
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
-// -
-// ========================LICENSE_START=================================
-// O-RAN-SC
-// %%
-// Copyright (C) 2021-2022: Nordix Foundation
-// %%
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================LICENSE_END===================================
-//
-
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
}
// HTTPClient interface
+//go:generate mockery --name HTTPClient
type HTTPClient interface {
Get(url string) (*http.Response, error)
"github.com/hashicorp/go-retryablehttp"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
- "oransc.org/usecase/oruclosedloop/mocks"
+ "oransc.org/usecase/oruclosedloop/internal/restclient/mocks"
)
func TestRequestError_Error(t *testing.T) {
-// -
-// ========================LICENSE_START=================================
-// O-RAN-SC
-// %%
-// Copyright (C) 2021-2022: Nordix Foundation
-// %%
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================LICENSE_END===================================
-//
-
// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
"github.com/stretchr/testify/require"
"oransc.org/usecase/oruclosedloop/internal/config"
"oransc.org/usecase/oruclosedloop/internal/linkfailure"
- "oransc.org/usecase/oruclosedloop/mocks"
+ repomock "oransc.org/usecase/oruclosedloop/internal/repository/mocks"
+ "oransc.org/usecase/oruclosedloop/internal/restclient/mocks"
)
func Test_init(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- mockCsvFileHelper := &mocks.CsvFileHelper{}
+ mockCsvFileHelper := &repomock.CsvFileHelper{}
mockCsvFileHelper.On("GetCsvFromFile", mock.Anything).Return(tt.args.mockReturn, tt.args.mockReturnError)
err := initializeLookupService(mockCsvFileHelper, tt.args.csvFile)
+++ /dev/null
-// -
-// ========================LICENSE_START=================================
-// O-RAN-SC
-// %%
-// Copyright (C) 2021-2022: Nordix Foundation
-// %%
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// ========================LICENSE_END===================================
-//
-
-// Code generated by mockery v1.0.0. DO NOT EDIT.
-
-package mocks
-
-import mock "github.com/stretchr/testify/mock"
-
-// CsvFileHelper is an autogenerated mock type for the CsvFileHelper type
-type CsvFileHelper struct {
- mock.Mock
-}
-
-// GetCsvFromFile provides a mock function with given fields: name
-func (_m *CsvFileHelper) GetCsvFromFile(name string) ([][]string, error) {
- ret := _m.Called(name)
-
- var r0 [][]string
- if rf, ok := ret.Get(0).(func(string) [][]string); ok {
- r0 = rf(name)
- } else {
- if ret.Get(0) != nil {
- r0 = ret.Get(0).([][]string)
- }
- }
-
- var r1 error
- if rf, ok := ret.Get(1).(func(string) error); ok {
- r1 = rf(name)
- } else {
- r1 = ret.Error(1)
- }
-
- return r0, r1
-}