NTP-4943 | updated unit tests of incident service (#462)
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/zap"
|
||||
"houston/contracts"
|
||||
"houston/logger"
|
||||
@@ -21,15 +20,6 @@ type EEMonitoringServiceClientImpl struct {
|
||||
WebhookAPIPath string
|
||||
}
|
||||
|
||||
func NewEEMonitoringServiceActionsImpl(client rest.HttpRestClient) *EEMonitoringServiceClientImpl {
|
||||
return &EEMonitoringServiceClientImpl{
|
||||
Client: client,
|
||||
BaseURL: viper.GetString("EE_MONITORING_SERVICE_BASEURL"),
|
||||
DefaultTimeout: viper.GetDuration("DEFAULT_EE_MONITORING_SERVICE_TIMEOUT"),
|
||||
WebhookAPIPath: viper.GetString("EE_MONITORING_SERVICE_WEBHOOK_API_PATH"),
|
||||
}
|
||||
}
|
||||
|
||||
func (client *EEMonitoringServiceClientImpl) TriggerSeverityUpdateWebhook(
|
||||
incidentId uint,
|
||||
triggerredBy string,
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
package monitoringService
|
||||
|
||||
import "houston/contracts"
|
||||
import (
|
||||
"github.com/spf13/viper"
|
||||
"houston/contracts"
|
||||
"houston/pkg/rest"
|
||||
)
|
||||
|
||||
type EEMonitoringServiceClient interface {
|
||||
TriggerSeverityUpdateWebhook(
|
||||
incidentId uint, triggerredBy string, requestId string, oldSeverity, newSeverity contracts.SeverityInfo,
|
||||
) error
|
||||
}
|
||||
|
||||
func NewEEMonitoringServiceClient(client rest.HttpRestClient) EEMonitoringServiceClient {
|
||||
return &EEMonitoringServiceClientImpl{
|
||||
Client: client,
|
||||
BaseURL: viper.GetString("EE_MONITORING_SERVICE_BASEURL"),
|
||||
DefaultTimeout: viper.GetDuration("DEFAULT_EE_MONITORING_SERVICE_TIMEOUT"),
|
||||
WebhookAPIPath: viper.GetString("EE_MONITORING_SERVICE_WEBHOOK_API_PATH"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func (suite *EEMonitoringServiceSuite) Test_TriggerWebhook_ErrorResponseCase() {
|
||||
responseChannel := make(chan service.MonitoringServiceClientResponse)
|
||||
defer close(responseChannel)
|
||||
|
||||
err := NewEEMonitoringServiceActionsImpl(restClient).TriggerSeverityUpdateWebhook(
|
||||
err := NewEEMonitoringServiceClient(restClient).TriggerSeverityUpdateWebhook(
|
||||
1, "test", requestId, getOldSeverity(), getNewSeverity(),
|
||||
)
|
||||
suite.Error(err)
|
||||
@@ -84,7 +84,7 @@ func (suite *EEMonitoringServiceSuite) Test_TriggerWebhook_SuccessCase() {
|
||||
|
||||
responseChannel := make(chan service.MonitoringServiceClientResponse)
|
||||
defer close(responseChannel)
|
||||
err := NewEEMonitoringServiceActionsImpl(restClient).TriggerSeverityUpdateWebhook(
|
||||
err := NewEEMonitoringServiceClient(restClient).TriggerSeverityUpdateWebhook(
|
||||
1, "test", requestId, getOldSeverity(), getNewSeverity(),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user