cloudflare/Cloudflare-Pivotal-Cloud-Foundry
Publicmirrored fromhttps://github.com/cloudflare/Cloudflare-Pivotal-Cloud-Foundry
api/cloudflare_test.go
33lines · modecode
9 years ago
| 1 | package api_test |
| 2 | |
| 3 | import ( |
| 4 | "reflect" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/cloudflare/Cloudflare-Pivotal-Cloud-Foundry/api" |
| 8 | ) |
| 9 | |
| 10 | func TestGetAuthHeaders(t *testing.T) { |
| 11 | email := "my@email.com" |
| 12 | key := "myKey" |
| 13 | auth := api.AuthHeaders{XAuthEmail: email, XAuthKey: key} |
| 14 | testApi := api.CloudflareAPI{Auth: auth} |
| 15 | testApi.Auth = auth |
| 16 | |
| 17 | result := testApi.GetAuthHeaders() |
| 18 | if !reflect.DeepEqual(result, auth) { |
| 19 | t.Errorf("GetAuthHeaders failed") |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | func TestSetAuthHeaders(t *testing.T) { |
| 24 | email := "my@email.com" |
| 25 | key := "myKey" |
| 26 | auth := api.AuthHeaders{XAuthEmail: email, XAuthKey: key} |
| 27 | testApi := api.CloudflareAPI{} |
| 28 | |
| 29 | testApi.SetAuthHeaders(auth) |
| 30 | if !reflect.DeepEqual(testApi.Auth, auth) { |
| 31 | t.Errorf("TestSetAuthHeaders failed") |
| 32 | } |
| 33 | } |