blob: 8fd20f8f812d5c63fb686ae7b1eaea3a472d3de0 [file] [log] [blame]
Jon Perritt3ec6cfd2014-10-06 16:49:48 -05001package gophercloud
2
3import (
4 "testing"
5
6 th "github.com/rackspace/gophercloud/testhelper"
7)
8
9func TestAuthenticatedHeaders(t *testing.T) {
10 p := &ProviderClient{
11 TokenID: "1234",
12 }
13 expected := map[string]string{"X-Auth-Token": "1234"}
14 actual := p.AuthenticatedHeaders()
15 th.CheckDeepEquals(t, expected, actual)
16}
Jon Perritt2b5e3e12015-02-13 12:15:08 -070017
18func TestUserAgent(t *testing.T) {
19 p := &ProviderClient{}
20
21 p.UserAgent.Prepend("custom-user-agent/v2.4")
22 expected := "custom-user-agent/v2.4 gophercloud/v1.0"
23 actual := p.UserAgent.Join()
24 th.CheckEquals(t, expected, actual)
25
26 p.UserAgent.Prepend("another-custom-user-agent/v0.3", "a-third-ua/v5.9")
27 expected = "another-custom-user-agent/v0.3 a-third-ua/v5.9 custom-user-agent/v2.4 gophercloud/v1.0"
28 actual = p.UserAgent.Join()
29 th.CheckEquals(t, expected, actual)
30
31 p.UserAgent = UserAgent{}
32 expected = "gophercloud/v1.0"
33 actual = p.UserAgent.Join()
34 th.CheckEquals(t, expected, actual)
35}