diff options
| author | Horus3 | 2015-03-19 16:41:39 +0100 |
|---|---|---|
| committer | Horus3 | 2015-03-19 16:41:39 +0100 |
| commit | 77b167ceae8904d827571a0ba7bfa13fac28a40e (patch) | |
| tree | dc320a8b89911686ebc7af79e2335968aa488e38 /user_test.go | |
| parent | e14cf986a916e1a7361b058224ef3badd3aad776 (diff) | |
| download | freemail-77b167ceae8904d827571a0ba7bfa13fac28a40e.tar.gz | |
Regression.
Diffstat (limited to 'user_test.go')
| -rw-r--r-- | user_test.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/user_test.go b/user_test.go new file mode 100644 index 0000000..3c2bc74 --- /dev/null +++ b/user_test.go @@ -0,0 +1,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) { +} |
