summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-11-22 11:05:54 -0800
committerHarrison Healey <harrisonmhealey@gmail.com>2016-11-22 14:05:54 -0500
commit7961599b2e41c71720a42b3bfde641f7529f05fe (patch)
tree3c039e1d3790a954ba65fe551c7b348331bce994 /vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go
parente033dcce8e57ed6b6684227adf9b29347e4718b3 (diff)
downloadchat-7961599b2e41c71720a42b3bfde641f7529f05fe.tar.gz
chat-7961599b2e41c71720a42b3bfde641f7529f05fe.tar.bz2
chat-7961599b2e41c71720a42b3bfde641f7529f05fe.zip
PLT-4357 adding performance monitoring (#4622)
* WIP * WIP * Adding metrics collection * updating vendor packages * Adding metrics to config * Adding admin console page for perf monitoring * Updating glide * switching to tylerb/graceful
Diffstat (limited to 'vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go')
-rw-r--r--vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go
new file mode 100644
index 000000000..41d328f1d
--- /dev/null
+++ b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg_test.go
@@ -0,0 +1,33 @@
+package goautoneg
+
+import (
+ "testing"
+)
+
+var chrome = "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"
+
+func TestParseAccept(t *testing.T) {
+ alternatives := []string{"text/html", "image/png"}
+ content_type := Negotiate(chrome, alternatives)
+ if content_type != "image/png" {
+ t.Errorf("got %s expected image/png", content_type)
+ }
+
+ alternatives = []string{"text/html", "text/plain", "text/n3"}
+ content_type = Negotiate(chrome, alternatives)
+ if content_type != "text/html" {
+ t.Errorf("got %s expected text/html", content_type)
+ }
+
+ alternatives = []string{"text/n3", "text/plain"}
+ content_type = Negotiate(chrome, alternatives)
+ if content_type != "text/plain" {
+ t.Errorf("got %s expected text/plain", content_type)
+ }
+
+ alternatives = []string{"text/n3", "application/rdf+xml"}
+ content_type = Negotiate(chrome, alternatives)
+ if content_type != "text/n3" {
+ t.Errorf("got %s expected text/n3", content_type)
+ }
+}