23
23
c.Assert(auth.Token, Equals, userInfo.Token)
24
24
c.Assert(auth.TenantId, Equals, userInfo.TenantId)
27
// Test that inexact region matches are handled properly.
28
func (s *UserPassTestSuite) TestRegionMatch(c *C) {
29
service := identityservice.NewUserPass()
30
service.SetupHTTP(s.Mux)
31
userInfo := service.AddUser("joe-user", "secrets", "tenant")
32
serviceDef := identityservice.Service{"swift", "object-store", []identityservice.Endpoint{
33
identityservice.Endpoint{PublicURL: "http://swift", Region: "RegionOne"},
35
service.AddService(serviceDef)
36
serviceDef = identityservice.Service{"nova", "compute", []identityservice.Endpoint{
37
identityservice.Endpoint{PublicURL: "http://nova", Region: "zone1.RegionOne"},
39
service.AddService(serviceDef)
40
serviceDef = identityservice.Service{"nova", "compute", []identityservice.Endpoint{
41
identityservice.Endpoint{PublicURL: "http://nova2", Region: "zone2.RegionOne"},
43
service.AddService(serviceDef)
47
URL: s.Server.URL + "/tokens",
49
Region: "zone1.RegionOne",
51
var l Authenticator = &UserPass{}
52
auth, err := l.Auth(&creds)
54
c.Assert(auth.ServiceURLs["object-store"], Equals, "http://swift")
55
c.Assert(auth.ServiceURLs["compute"], Equals, "http://nova")
56
c.Assert(auth.Token, Equals, userInfo.Token)
57
c.Assert(auth.TenantId, Equals, userInfo.TenantId)