2018-05-27 12:31:47 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/onsi/ginkgo"
|
|
|
|
. "github.com/onsi/gomega"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHTTPServer(t *testing.T) {
|
|
|
|
RegisterFailHandler(Fail)
|
|
|
|
RunSpecs(t, "HTTP Server tests")
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ = Describe("HTTP Server", func() {
|
2018-06-17 13:25:00 +00:00
|
|
|
It("should return plain text", func() {
|
|
|
|
response := getPath("/smorgasbord", "plain")
|
2018-05-27 12:31:47 +00:00
|
|
|
Expect(response).To(ContainSubstring("multiple hot Smörgås"))
|
|
|
|
Expect(response).To(ContainSubstring("A special Swedish type of smörgåsbord"))
|
2018-06-17 13:25:00 +00:00
|
|
|
Expect(response).ToNot(ContainSubstring("<a href"))
|
|
|
|
})
|
|
|
|
|
|
|
|
It("should return HTML text", func() {
|
|
|
|
response := getPath("/smorgasbord", "html")
|
|
|
|
Expect(response).To(ContainSubstring(
|
|
|
|
"<a href=\"/http://localhost:4444/smorgasbord/another.html\">Another page</a>"))
|
2018-05-27 12:31:47 +00:00
|
|
|
})
|
2018-07-08 05:51:23 +00:00
|
|
|
|
|
|
|
It("should return a background image", func() {
|
|
|
|
response := getPath("/smorgasbord", "html")
|
|
|
|
Expect(response).To(ContainSubstring("background-image: url(data:image/jpeg"))
|
|
|
|
})
|
2018-05-27 12:31:47 +00:00
|
|
|
})
|