blob: 0d7c0d32d4b5952c8a1f9a110874dcee3ecfd620 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package main
import (
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestBlubberoid(t *testing.T) {
rec := httptest.NewRecorder()
req := httptest.NewRequest("POST", "/test", strings.NewReader(`---
version: v3
base: foo
variants:
test: {}`))
blubberoid(rec, req)
resp := rec.Result()
body, _ := ioutil.ReadAll(resp.Body)
assert.Equal(t, http.StatusOK, resp.StatusCode)
assert.Equal(t, "text/plain", resp.Header.Get("Content-Type"))
assert.Contains(t, string(body), "FROM foo")
assert.Contains(t, string(body), `LABEL blubber.variant="test"`)
}
|