package main import ( "testing" ) func TestHashPassword(t *testing.T) { vU := VirtualUser{} vU.Password = "md5hash" vU.Password = vU.HashPassword() if vU.Password != "f9d08276bc85d30d578e8883f3c7e843" { t.Fatal("Expected 'f9d08276bc85d30d578e8883f3c7e843' as hash. Got %s.", vU.Password) } } func TestAuthUser(t *testing.T) { vU := VirtualUser{Email: "test@example.com", Password: "password"} if !vU.AuthUser() { t.Fatal("Authentification failed.") } vU.Password = "Password" if vU.AuthUser() { t.Fatal("Authentification succeeded with wrong password.") } } func TestUpdatePassword(t *testing.T) { vU := VirtualUser{Email: "test@example.com", Password: "password"} if vU.UpdatePassword(vU.Password) { t.Fatal("Update password even when both passwords be equal.") } if vU.UpdatePassword("") { t.Fatal("Update password even with empty password.") } if !vU.UpdatePassword("Password") { t.Fatal("Updating password failed.") } } func TestCreateAlias(t *testing.T) { //vA := VirtualAlias(Source: "") } func TestAliasExists(t *testing.T) { }