Skip to content

Commit

Permalink
added a "Success" test for script notifications.
Browse files Browse the repository at this point in the history
bumping the version in version file? not sure why it wasnt correctly bumped already.
  • Loading branch information
AnalogJ committed Nov 3, 2020
1 parent 58eaa29 commit 93cf676
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion webapp/backend/pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package version

// VERSION is the app-global version string, which will be replaced with a
// new value during packaging
const VERSION = "0.3.0"
const VERSION = "0.3.1"
24 changes: 24 additions & 0 deletions webapp/backend/pkg/web/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,30 @@ func TestSendTestNotificationRoute_ScriptFailure(t *testing.T) {
require.Equal(t, 500, wr.Code)
}

func TestSendTestNotificationRoute_ScriptSuccess(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{"script:///usr/bin/env"})
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_ShoutrrrFailure(t *testing.T) {
//setup
parentPath, _ := ioutil.TempDir("", "")
Expand Down

0 comments on commit 93cf676

Please sign in to comment.