Files
docker-cli/components/engine/auth/auth_test.go
Ken Cochrane c24c054d47 added ability to login/register to the docker registry, via the docker login command
Upstream-commit: be20f3c518cb1587a2c731a1d6d91bdedcbf1dc9
Component: engine
2013-03-14 17:43:59 -07:00

24 lines
601 B
Go

package auth
import (
"testing"
)
func TestEncodeAuth(t *testing.T) {
newAuthConfig := AuthConfig{Username: "ken", Password: "test", Email: "test@example.com"}
authStr := EncodeAuth(newAuthConfig)
decAuthConfig, err := DecodeAuth(authStr)
if err != nil {
t.Fatal(err)
}
if newAuthConfig.Username != decAuthConfig.Username {
t.Fatal("Encode Username doesn't match decoded Username")
}
if newAuthConfig.Password != decAuthConfig.Password {
t.Fatal("Encode Password doesn't match decoded Password")
}
if authStr != "a2VuOnRlc3Q=" {
t.Fatal("AuthString encoding isn't correct.")
}
}