blob: 2936526401c933db5070f6b907fc09bb7433fa39 [file] [log] [blame]
Samuel A. Falvo IIfd78c302013-06-25 16:35:32 -07001package gophercloud
2
3import (
4 "testing"
5)
6
7func 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 II4e895182013-06-26 15:44:18 -070016 err = c.RegisterProvider("aProvider", Provider{})
Samuel A. Falvo II5d0d74c2013-06-25 17:23:18 -070017 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 II4e895182013-06-26 15:44:18 -070022 _ = c.RegisterProvider("aProvider", Provider{AuthEndpoint: "http://localhost/auth"})
Samuel A. Falvo IIfd78c302013-06-25 16:35:32 -070023 _, err = c.ProviderByName("aProvider")
24 if err != nil {
25 t.Error(err)
26 return
27 }
28}