bine/control/controltest/cmd_authenticate_test.go

24 lines
752 B
Go
Raw Normal View History

2018-05-10 23:05:43 +00:00
package controltest
import "testing"
func TestAuthenticateNull(t *testing.T) {
ctx, conn := NewTestContextConnected(t)
defer ctx.CloseConnected(conn)
ctx.Require.NoError(conn.Authenticate(""))
}
func TestAuthenticateSafeCookie(t *testing.T) {
ctx, conn := NewTestContextConnected(t, "--CookieAuthentication", "1")
defer ctx.CloseConnected(conn)
ctx.Require.NoError(conn.Authenticate(""))
}
func TestAuthenticateHashedPassword(t *testing.T) {
// "testpass" - 16:5417AE717521511A609921392778FFA8518EC089BF2162A199241AEB4A
ctx, conn := NewTestContextConnected(t, "--HashedControlPassword",
"16:5417AE717521511A609921392778FFA8518EC089BF2162A199241AEB4A")
defer ctx.CloseConnected(conn)
ctx.Require.NoError(conn.Authenticate("testpass"))
}