This repository has been archived on 2024-11-03. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mattermost-plugin-attachmen.../server/plugin_test.go
Ben Schumacher f5e50c1e17
Integrate GolangCI-Lint (#90)
* Use plugin orb for ci

* Add golangci-lint config and fix issues

* Simplify circleci config

* Drop unparam

* Drop maligned

* Ignore varcheck in server/manifest.go
2020-04-02 15:01:00 -03:00

28 lines
529 B
Go

package main
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestServeHTTP(t *testing.T) {
assert := assert.New(t)
plugin := Plugin{}
w := httptest.NewRecorder()
r := httptest.NewRequest(http.MethodGet, "/", nil)
plugin.ServeHTTP(nil, w, r)
result := w.Result()
assert.NotNil(result)
defer result.Body.Close()
bodyBytes, err := ioutil.ReadAll(result.Body)
assert.Nil(err)
bodyString := string(bodyBytes)
assert.Equal("Hello, world!", bodyString)
}