summaryrefslogtreecommitdiff
path: root/cmd/blubberoid/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/blubberoid/main_test.go')
-rw-r--r--cmd/blubberoid/main_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/cmd/blubberoid/main_test.go b/cmd/blubberoid/main_test.go
new file mode 100644
index 0000000..0d7c0d3
--- /dev/null
+++ b/cmd/blubberoid/main_test.go
@@ -0,0 +1,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"`)
+}