More technical debt payoff.
Applied refactoring across the entire acceptance test code base.
diff --git a/acceptance/06-list-flavors.go b/acceptance/06-list-flavors.go
index ad56988..28ac215 100644
--- a/acceptance/06-list-flavors.go
+++ b/acceptance/06-list-flavors.go
@@ -10,39 +10,21 @@
var rgn = flag.String("r", "DFW", "Datacenter region to interrogate.")
func main() {
- provider, username, password := getCredentials()
flag.Parse()
- auth, err := gophercloud.Authenticate(
- provider,
- gophercloud.AuthOptions{
- Username: username,
- Password: password,
- },
- )
- if err != nil {
- panic(err)
- }
+ withIdentity(false, func(auth gophercloud.AccessProvider) {
+ withServerApi(auth, func(servers gophercloud.CloudServersProvider) {
+ flavors, err := servers.ListFlavors()
+ if err != nil {
+ panic(err)
+ }
- servers, err := gophercloud.ServersApi(auth, gophercloud.ApiCriteria{
- Name: "cloudServersOpenStack",
- Region: *rgn,
- VersionId: "2",
- UrlChoice: gophercloud.PublicURL,
+ if !*quiet {
+ fmt.Println("ID,Name,MinRam,MinDisk")
+ for _, f := range flavors {
+ fmt.Printf("%s,\"%s\",%d,%d\n", f.Id, f.Name, f.Ram, f.Disk)
+ }
+ }
+ })
})
- if err != nil {
- panic(err)
- }
-
- flavors, err := servers.ListFlavors()
- if err != nil {
- panic(err)
- }
-
- if !*quiet {
- fmt.Println("ID,Name,MinRam,MinDisk")
- for _, f := range flavors {
- fmt.Printf("%s,\"%s\",%d,%d\n", f.Id, f.Name, f.Ram, f.Disk)
- }
- }
}