| package testing |
| |
| import ( |
| "testing" |
| |
| "gerrit.mcp.mirantis.net/debian/gophercloud.git" |
| th "gerrit.mcp.mirantis.net/debian/gophercloud.git/testhelper" |
| ) |
| |
| func TestAuthenticatedHeaders(t *testing.T) { |
| p := &gophercloud.ProviderClient{ |
| TokenID: "1234", |
| } |
| expected := map[string]string{"X-Auth-Token": "1234"} |
| actual := p.AuthenticatedHeaders() |
| th.CheckDeepEquals(t, expected, actual) |
| } |
| |
| func TestUserAgent(t *testing.T) { |
| p := &gophercloud.ProviderClient{} |
| |
| p.UserAgent.Prepend("custom-user-agent/2.4.0") |
| expected := "custom-user-agent/2.4.0 gophercloud/2.0.0" |
| actual := p.UserAgent.Join() |
| th.CheckEquals(t, expected, actual) |
| |
| p.UserAgent.Prepend("another-custom-user-agent/0.3.0", "a-third-ua/5.9.0") |
| expected = "another-custom-user-agent/0.3.0 a-third-ua/5.9.0 custom-user-agent/2.4.0 gophercloud/2.0.0" |
| actual = p.UserAgent.Join() |
| th.CheckEquals(t, expected, actual) |
| |
| p.UserAgent = gophercloud.UserAgent{} |
| expected = "gophercloud/2.0.0" |
| actual = p.UserAgent.Join() |
| th.CheckEquals(t, expected, actual) |
| } |