blob: 3c2bc74d5c47e1a02fe54b1cbe3d837132361739 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
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) {
}
|