1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-14 11:03:09 +02:00
sap-jenkins-library/pkg/piperutils/credentials_test.go
Jk1484 ffc931aad1
feat(golangBuild): use 'unit' build tag to include tests during test execution (#4345)
* Added unit tag as argument. Added description to runTests command. Changed code generator to have unit build tag in generated unit test files.

* Added unit build tag to all unit test files.

* added to new unit test unit build tag

* Update verify-go.yml

* small fix

---------

Co-authored-by: Muhammadali Nazarov <Muhammadali.Nazarov@acronis.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
2023-05-03 21:02:11 +05:00

50 lines
984 B
Go

//go:build unit
// +build unit
package piperutils
import (
"testing"
)
func TestEncodeUsernamePassword(t *testing.T) {
type args struct {
username string
password string
}
tests := []struct {
name string
args args
want string
}{
{args: args{username: "anything", password: "something"}, want: "YW55dGhpbmc6c29tZXRoaW5n"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := EncodeUsernamePassword(tt.args.username, tt.args.password); got != tt.want {
t.Errorf("EncodeUsernamePassword() = %v, want %v", got, tt.want)
}
})
}
}
func TestEncodeToken(t *testing.T) {
type args struct {
token string
}
tests := []struct {
name string
args args
want string
}{
{args: args{token: "anything"}, want: "YW55dGhpbmc="},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := EncodeString(tt.args.token); got != tt.want {
t.Errorf("EncodeToken() = %v, want %v", got, tt.want)
}
})
}
}