~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/gopkg.in/goose.v1/client/local_test.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
                s.service = openstackservice.New(s.cred, identity.AuthKeyPair)
59
59
                // Add an additional endpoint so region filtering can be properly tested.
60
60
                serviceDef := identityservice.Service{
61
 
                        Name: "nova",
62
 
                        Type: "compute",
63
 
                        Endpoints: []identityservice.Endpoint{
64
 
                                {PublicURL: "http://nova2", Region: "zone2.RegionOne"},
 
61
                        V2: identityservice.V2Service{
 
62
                                Name: "nova",
 
63
                                Type: "compute",
 
64
                                Endpoints: []identityservice.Endpoint{
 
65
                                        {PublicURL: "http://nova2", Region: "zone2.RegionOne"},
 
66
                                },
65
67
                        }}
66
68
                s.service.(*openstackservice.Openstack).Identity.AddService(serviceDef)
67
69
        case identity.AuthUserPass:
69
71
                s.service = openstackservice.New(s.cred, identity.AuthUserPass)
70
72
                // Add an additional endpoint so region filtering can be properly tested.
71
73
                serviceDef := identityservice.Service{
72
 
                        Name: "nova",
73
 
                        Type: "compute",
74
 
                        Endpoints: []identityservice.Endpoint{
75
 
                                {PublicURL: "http://nova2", Region: "zone2.RegionOne"},
 
74
                        V2: identityservice.V2Service{
 
75
                                Name: "nova",
 
76
                                Type: "compute",
 
77
                                Endpoints: []identityservice.Endpoint{
 
78
                                        {PublicURL: "http://nova2", Region: "zone2.RegionOne"},
 
79
                                },
 
80
                        }}
 
81
                s.service.(*openstackservice.Openstack).Identity.AddService(serviceDef)
 
82
        case identity.AuthUserPassV3:
 
83
                // The openstack test service sets up userpass authentication.
 
84
                s.service = openstackservice.New(s.cred, identity.AuthUserPass)
 
85
                // Add an additional endpoint so region filtering can be properly tested.
 
86
                serviceDef := identityservice.Service{
 
87
                        V3: identityservice.V3Service{
 
88
                                Name:      "nova",
 
89
                                Type:      "compute",
 
90
                                Endpoints: identityservice.NewV3Endpoints("", "", "http://nova2", "zone2.RegionOne"),
76
91
                        }}
77
92
                s.service.(*openstackservice.Openstack).Identity.AddService(serviceDef)
78
93
 
362
377
        s.service = openstackservice.New(s.cred, identity.AuthUserPass)
363
378
        // Add an additional endpoint so region filtering can be properly tested.
364
379
        serviceDef := identityservice.Service{
365
 
                Name: "nova",
366
 
                Type: "compute",
367
 
                Endpoints: []identityservice.Endpoint{
368
 
                        {PublicURL: "https://nova2", Region: "zone2.RegionOne"},
 
380
                V2: identityservice.V2Service{
 
381
                        Name: "nova",
 
382
                        Type: "compute",
 
383
                        Endpoints: []identityservice.Endpoint{
 
384
                                {PublicURL: "https://nova2", Region: "zone2.RegionOne"},
 
385
                        },
369
386
                }}
370
387
        s.service.(*openstackservice.Openstack).Identity.AddService(serviceDef)
371
388
}
436
453
        c.Assert(err, gc.IsNil)
437
454
        c.Assert(contents, gc.DeepEquals, []swift.ContainerContents{})
438
455
}
 
456
 
 
457
func (s *localHTTPSSuite) TestAuthDiscover(c *gc.C) {
 
458
        cl := client.NewNonValidatingClient(s.cred, identity.AuthUserPass, nil)
 
459
        options, err := cl.IdentityAuthOptions()
 
460
        c.Assert(err, gc.IsNil)
 
461
        c.Assert(options, gc.DeepEquals, identity.AuthOptions{identity.AuthOption{Mode: 3, Endpoint: s.cred.URL + "/v3/"}, identity.AuthOption{Mode: 1, Endpoint: s.cred.URL + "/v2.0/"}})
 
462
}