Samuel A. Falvo II | fd78c30 | 2013-06-25 16:35:32 -0700 | [diff] [blame] | 1 | package gophercloud |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | ) |
| 6 | |
| 7 | func TestProviderRegistry(t *testing.T) { |
| 8 | c := TestContext() |
| 9 | |
| 10 | _, err := c.ProviderByName("aProvider") |
| 11 | if err == nil { |
| 12 | t.Error("Expected error when looking for a provider by non-existant name") |
| 13 | return |
| 14 | } |
| 15 | |
Samuel A. Falvo II | 4e89518 | 2013-06-26 15:44:18 -0700 | [diff] [blame] | 16 | err = c.RegisterProvider("aProvider", Provider{}) |
Samuel A. Falvo II | 5d0d74c | 2013-06-25 17:23:18 -0700 | [diff] [blame] | 17 | if err != ErrConfiguration { |
| 18 | t.Error("Unexpected error/nil when registering a provider w/out an auth endpoint\n %s", err) |
| 19 | return |
| 20 | } |
| 21 | |
Samuel A. Falvo II | 4e89518 | 2013-06-26 15:44:18 -0700 | [diff] [blame] | 22 | _ = c.RegisterProvider("aProvider", Provider{AuthEndpoint: "http://localhost/auth"}) |
Samuel A. Falvo II | fd78c30 | 2013-06-25 16:35:32 -0700 | [diff] [blame] | 23 | _, err = c.ProviderByName("aProvider") |
| 24 | if err != nil { |
| 25 | t.Error(err) |
| 26 | return |
| 27 | } |
| 28 | } |