Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit 7e51112

Browse files
committed
Add UT test to openstack_test.go
1 parent a33280d commit 7e51112

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

pkg/cloudprovider/providers/openstack/openstack_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,37 @@ func TestInstanceIDFromProviderID(t *testing.T) {
585585
}
586586
}
587587
}
588+
589+
func TestToAuth3Options(t *testing.T) {
590+
cfg := Config{}
591+
cfg.Global.Username = "user"
592+
cfg.Global.Password = "pass"
593+
cfg.Global.DomainId = "2a73b8f597c04551a0fdc8e95544be8a"
594+
cfg.Global.DomainName = "local"
595+
cfg.Global.AuthUrl = "http://auth.url"
596+
cfg.Global.UserId = "user"
597+
598+
ao := cfg.toAuth3Options()
599+
600+
if !ao.AllowReauth {
601+
t.Errorf("Will need to be able to reauthenticate")
602+
}
603+
if ao.Username != cfg.Global.Username {
604+
t.Errorf("Username %s != %s", ao.Username, cfg.Global.Username)
605+
}
606+
if ao.Password != cfg.Global.Password {
607+
t.Errorf("Password %s != %s", ao.Password, cfg.Global.Password)
608+
}
609+
if ao.DomainID != cfg.Global.DomainId {
610+
t.Errorf("DomainID %s != %s", ao.DomainID, cfg.Global.DomainId)
611+
}
612+
if ao.IdentityEndpoint != cfg.Global.AuthUrl {
613+
t.Errorf("IdentityEndpoint %s != %s", ao.IdentityEndpoint, cfg.Global.AuthUrl)
614+
}
615+
if ao.UserID != cfg.Global.UserId {
616+
t.Errorf("UserID %s != %s", ao.UserID, cfg.Global.UserId)
617+
}
618+
if ao.DomainName != cfg.Global.DomainName {
619+
t.Errorf("DomainName %s != %s", ao.DomainName, cfg.Global.DomainName)
620+
}
621+
}

0 commit comments

Comments
 (0)