Ai
1 Star 0 Fork 0

Alibaba Cloud/saml2alibabacloud

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
input_test.go 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
紫英 提交于 2020-12-28 17:21 +08:00 . :boom:integrate with AlibabaCloud
package saml2alibabacloud
import (
"testing"
"github.com/aliyun/saml2alibabacloud/pkg/creds"
)
func TestLoginDetails_Validate(t *testing.T) {
type fields struct {
Username string
Password string
URL string
}
tests := []struct {
name string
fields fields
wantErr bool
}{
// TODO: Add test cases.
{name: "hostname missing error", fields: fields{}, wantErr: true},
{name: "username missing error", fields: fields{URL: "id.example.com"}, wantErr: true},
{name: "password missing error", fields: fields{URL: "id.example.com", Username: "test"}, wantErr: true},
{name: "ok", fields: fields{URL: "id.example.com", Username: "test", Password: "test"}, wantErr: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ld := &creds.LoginDetails{
Username: tt.fields.Username,
Password: tt.fields.Password,
URL: tt.fields.URL,
}
if err := ld.Validate(); (err != nil) != tt.wantErr {
t.Errorf("LoginDetails.Validate() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/aliyun/saml2alibabacloud.git
git@gitee.com:aliyun/saml2alibabacloud.git
aliyun
saml2alibabacloud
saml2alibabacloud
master

搜索帮助