TP-47105 | Removing logger input for document service (#287)

* TP-47105 | Removing logger input for documnet service

* TP-47105 | Removing logger input for documnet service
This commit is contained in:
Sriram Bhargav
2023-11-17 12:11:30 +05:30
committed by GitHub
parent ebcd074286
commit 28eeac680a
2 changed files with 8 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ type ActionsImpl struct {
DefaultTimeout time.Duration DefaultTimeout time.Duration
} }
func NewActionsImpl(logger *zap.Logger, client rest.ClientActions) *ActionsImpl { func NewActionsImpl(client rest.ClientActions) *ActionsImpl {
return &ActionsImpl{ return &ActionsImpl{
Client: client, Client: client,
BaseURL: viper.GetString("DOCUMENT_SERVICE_BASEURL"), BaseURL: viper.GetString("DOCUMENT_SERVICE_BASEURL"),

View File

@@ -72,7 +72,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileUploadPreSignedURL_Fai
suite.defaultTimeout, nil). suite.defaultTimeout, nil).
Then(nil, errors.New("error while generating pre-signed url")) Then(nil, errors.New("error while generating pre-signed url"))
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
_, err = documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId") _, err = documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId")
suite.Equal("error while generating pre-signed url", err.Error()) suite.Equal("error while generating pre-signed url", err.Error())
@@ -102,7 +102,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileUploadPreSignedURL_Nil
suite.defaultTimeout, nil). suite.defaultTimeout, nil).
Then(&http.Response{StatusCode: http.StatusOK, Body: nil}, nil) Then(&http.Response{StatusCode: http.StatusOK, Body: nil}, nil)
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
fileUploadResponse, err := documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId") fileUploadResponse, err := documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId")
assert.Nil(suite.T(), fileUploadResponse) assert.Nil(suite.T(), fileUploadResponse)
@@ -136,7 +136,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileUploadPreSignedURL_Res
Body: io.NopCloser(bytes.NewBufferString(string(responseBody))), Body: io.NopCloser(bytes.NewBufferString(string(responseBody))),
}, nil) }, nil)
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
fileUploadResponse, err := documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId") fileUploadResponse, err := documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId")
assert.Nil(suite.T(), fileUploadResponse) assert.Nil(suite.T(), fileUploadResponse)
@@ -183,7 +183,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileUploadPreSignedURL_Suc
Body: io.NopCloser(bytes.NewBufferString(string(responseBody))), Body: io.NopCloser(bytes.NewBufferString(string(responseBody))),
}, nil) }, nil)
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
fileUploadResponse, err := documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId") fileUploadResponse, err := documentServiceImpl.GenerateFileUploadPreSignedURL("fileType", "flowId")
assert.Nil(suite.T(), err) assert.Nil(suite.T(), err)
@@ -213,7 +213,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileDownloadPreSignedURL_F
documentDownloadURL := suite.baseURL + suite.downloadPreSignedURLGeneratorPath documentDownloadURL := suite.baseURL + suite.downloadPreSignedURLGeneratorPath
restActions.GetWithTimeoutMock.When(documentDownloadURL, params, headers, suite.defaultTimeout, false). restActions.GetWithTimeoutMock.When(documentDownloadURL, params, headers, suite.defaultTimeout, false).
Then(nil, errors.New("error while generating pre-signed url")) Then(nil, errors.New("error while generating pre-signed url"))
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
resp, err := documentServiceImpl.GenerateFileDownloadPreSignedURL(fileDownloadPreSignedURLRequest) resp, err := documentServiceImpl.GenerateFileDownloadPreSignedURL(fileDownloadPreSignedURLRequest)
suite.Equal("error while generating pre-signed url", err.Error()) suite.Equal("error while generating pre-signed url", err.Error())
suite.Equal(resp, "") suite.Equal(resp, "")
@@ -251,7 +251,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileDownloadPreSignedURL_E
documentDownloadURL := suite.baseURL + suite.downloadPreSignedURLGeneratorPath documentDownloadURL := suite.baseURL + suite.downloadPreSignedURLGeneratorPath
restActions.GetWithTimeoutMock.When(documentDownloadURL, params, headers, suite.defaultTimeout, false). restActions.GetWithTimeoutMock.When(documentDownloadURL, params, headers, suite.defaultTimeout, false).
Then(&finalResponse, nil) Then(&finalResponse, nil)
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
resp, err := documentServiceImpl.GenerateFileDownloadPreSignedURL(fileDownloadPreSignedURLRequest) resp, err := documentServiceImpl.GenerateFileDownloadPreSignedURL(fileDownloadPreSignedURLRequest)
suite.Equal("file download URL generation failed", err.Error()) suite.Equal("file download URL generation failed", err.Error())
suite.Equal(resp, "") suite.Equal(resp, "")
@@ -289,7 +289,7 @@ func (suite *DocumentServiceClientSuite) Test_GenerateFileDownloadPreSignedURL_N
documentDownloadURL := suite.baseURL + suite.downloadPreSignedURLGeneratorPath documentDownloadURL := suite.baseURL + suite.downloadPreSignedURLGeneratorPath
restActions.GetWithTimeoutMock.When(documentDownloadURL, params, headers, suite.defaultTimeout, false). restActions.GetWithTimeoutMock.When(documentDownloadURL, params, headers, suite.defaultTimeout, false).
Then(&finalResponse, nil) Then(&finalResponse, nil)
documentServiceImpl := NewActionsImpl(logger.GetLogger(), restActions) documentServiceImpl := NewActionsImpl(restActions)
resp, err := documentServiceImpl.GenerateFileDownloadPreSignedURL(fileDownloadPreSignedURLRequest) resp, err := documentServiceImpl.GenerateFileDownloadPreSignedURL(fileDownloadPreSignedURLRequest)
suite.Equal("file download URL generation failed", err.Error()) suite.Equal("file download URL generation failed", err.Error())
suite.Equal(resp, "") suite.Equal(resp, "")