|
|
@ -164,29 +164,30 @@ func TestPopulateMultiple(t *testing.T) {
|
|
|
|
//assert
|
|
|
|
//assert
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestSendTestNotificationRoute(t *testing.T) {
|
|
|
|
//TODO: this test should use a recorded request/response playback.
|
|
|
|
//setup
|
|
|
|
//func TestSendTestNotificationRoute(t *testing.T) {
|
|
|
|
parentPath, _ := ioutil.TempDir("", "")
|
|
|
|
// //setup
|
|
|
|
defer os.RemoveAll(parentPath)
|
|
|
|
// parentPath, _ := ioutil.TempDir("", "")
|
|
|
|
mockCtrl := gomock.NewController(t)
|
|
|
|
// defer os.RemoveAll(parentPath)
|
|
|
|
defer mockCtrl.Finish()
|
|
|
|
// mockCtrl := gomock.NewController(t)
|
|
|
|
fakeConfig := mock_config.NewMockInterface(mockCtrl)
|
|
|
|
// defer mockCtrl.Finish()
|
|
|
|
fakeConfig.EXPECT().GetString("web.database.location").AnyTimes().Return(path.Join(parentPath, "scrutiny_test.db"))
|
|
|
|
// fakeConfig := mock_config.NewMockInterface(mockCtrl)
|
|
|
|
fakeConfig.EXPECT().GetString("web.src.frontend.path").AnyTimes().Return(parentPath)
|
|
|
|
// fakeConfig.EXPECT().GetString("web.database.location").AnyTimes().Return(path.Join(parentPath, "scrutiny_test.db"))
|
|
|
|
fakeConfig.EXPECT().GetStringSlice("notify.urls").AnyTimes().Return([]string{"https://scrutiny.requestcatcher.com/test"})
|
|
|
|
// fakeConfig.EXPECT().GetString("web.src.frontend.path").AnyTimes().Return(parentPath)
|
|
|
|
ae := web.AppEngine{
|
|
|
|
// fakeConfig.EXPECT().GetStringSlice("notify.urls").AnyTimes().Return([]string{"https://scrutiny.requestcatcher.com/test"})
|
|
|
|
Config: fakeConfig,
|
|
|
|
// ae := web.AppEngine{
|
|
|
|
}
|
|
|
|
// Config: fakeConfig,
|
|
|
|
router := ae.Setup(logrus.New())
|
|
|
|
// }
|
|
|
|
|
|
|
|
// router := ae.Setup(logrus.New())
|
|
|
|
//test
|
|
|
|
//
|
|
|
|
wr := httptest.NewRecorder()
|
|
|
|
// //test
|
|
|
|
req, _ := http.NewRequest("POST", "/api/health/notify", strings.NewReader("{}"))
|
|
|
|
// wr := httptest.NewRecorder()
|
|
|
|
router.ServeHTTP(wr, req)
|
|
|
|
// req, _ := http.NewRequest("POST", "/api/health/notify", strings.NewReader("{}"))
|
|
|
|
|
|
|
|
// router.ServeHTTP(wr, req)
|
|
|
|
//assert
|
|
|
|
//
|
|
|
|
require.Equal(t, 200, wr.Code)
|
|
|
|
// //assert
|
|
|
|
}
|
|
|
|
// require.Equal(t, 200, wr.Code)
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
func TestSendTestNotificationRoute_WebhookFailure(t *testing.T) {
|
|
|
|
func TestSendTestNotificationRoute_WebhookFailure(t *testing.T) {
|
|
|
|
//setup
|
|
|
|
//setup
|
|
|
|