From f27883ea4cb995c2cf7722d63e26c95b670a4e06 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Thu, 8 Oct 2020 00:24:33 -0600 Subject: [PATCH] remove requestcatcher live test. --- webapp/backend/pkg/web/server_test.go | 47 ++++++++++++++------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/webapp/backend/pkg/web/server_test.go b/webapp/backend/pkg/web/server_test.go index e121a2d..adb7b12 100644 --- a/webapp/backend/pkg/web/server_test.go +++ b/webapp/backend/pkg/web/server_test.go @@ -164,29 +164,30 @@ func TestPopulateMultiple(t *testing.T) { //assert } -func TestSendTestNotificationRoute(t *testing.T) { - //setup - parentPath, _ := ioutil.TempDir("", "") - defer os.RemoveAll(parentPath) - mockCtrl := gomock.NewController(t) - defer mockCtrl.Finish() - fakeConfig := mock_config.NewMockInterface(mockCtrl) - fakeConfig.EXPECT().GetString("web.database.location").AnyTimes().Return(path.Join(parentPath, "scrutiny_test.db")) - fakeConfig.EXPECT().GetString("web.src.frontend.path").AnyTimes().Return(parentPath) - fakeConfig.EXPECT().GetStringSlice("notify.urls").AnyTimes().Return([]string{"https://scrutiny.requestcatcher.com/test"}) - ae := web.AppEngine{ - Config: fakeConfig, - } - router := ae.Setup(logrus.New()) - - //test - wr := httptest.NewRecorder() - req, _ := http.NewRequest("POST", "/api/health/notify", strings.NewReader("{}")) - router.ServeHTTP(wr, req) - - //assert - require.Equal(t, 200, wr.Code) -} +//TODO: this test should use a recorded request/response playback. +//func TestSendTestNotificationRoute(t *testing.T) { +// //setup +// parentPath, _ := ioutil.TempDir("", "") +// defer os.RemoveAll(parentPath) +// mockCtrl := gomock.NewController(t) +// defer mockCtrl.Finish() +// fakeConfig := mock_config.NewMockInterface(mockCtrl) +// fakeConfig.EXPECT().GetString("web.database.location").AnyTimes().Return(path.Join(parentPath, "scrutiny_test.db")) +// fakeConfig.EXPECT().GetString("web.src.frontend.path").AnyTimes().Return(parentPath) +// fakeConfig.EXPECT().GetStringSlice("notify.urls").AnyTimes().Return([]string{"https://scrutiny.requestcatcher.com/test"}) +// ae := web.AppEngine{ +// Config: fakeConfig, +// } +// router := ae.Setup(logrus.New()) +// +// //test +// wr := httptest.NewRecorder() +// req, _ := http.NewRequest("POST", "/api/health/notify", strings.NewReader("{}")) +// router.ServeHTTP(wr, req) +// +// //assert +// require.Equal(t, 200, wr.Code) +//} func TestSendTestNotificationRoute_WebhookFailure(t *testing.T) { //setup