config_test.go 396 B

1234567891011121314151617181920
  1. package main
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. // TestUserAgent tests User Agent
  7. func TestUserAgent(t *testing.T) {
  8. conf := readConfig("gof.example.yaml")
  9. if conf.HttpConfig.UserAgent == "" {
  10. t.Error("UserAgent is blank")
  11. }
  12. expected := fmt.Sprintf("%s/%s",
  13. conf.Meta.Name, conf.Meta.Version)
  14. if conf.HttpConfig.UserAgent != expected {
  15. t.Error("UserAgent did not match expectation")
  16. }
  17. }