diff options
| author | horus_arch | 2015-03-19 13:39:37 +0100 |
|---|---|---|
| committer | horus_arch | 2015-03-19 13:39:37 +0100 |
| commit | f334c93c0364d14a2b55641b155ad58f715a4b39 (patch) | |
| tree | 63ffbfc845f441802bd59c07adf2d9fe2f86c4bc /email_test.go | |
| parent | 3c9bdbc66998075278f7d79fa10709e7fab5deb6 (diff) | |
| download | freemail-f334c93c0364d14a2b55641b155ad58f715a4b39.tar.gz | |
Rewriting from scratch.
Diffstat (limited to 'email_test.go')
| -rw-r--r-- | email_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/email_test.go b/email_test.go new file mode 100644 index 0000000..887eb8d --- /dev/null +++ b/email_test.go @@ -0,0 +1,37 @@ +package main + +import ( + "os" + "testing" +) + +func TestCreateEmail(t *testing.T) { + InitDB() + t.Log("Using database: " + os.Getenv("FREEMAIL_DB_CREDENTIALS")) + if success, err := CreateEmail("test@example.com", "password"); err != nil || !success { + t.Fatal("Can't create email.", err) + } else { + t.Log("test@example.com") + } +} +func TestEmailExists(t *testing.T) { + t.Log("Using database: " + os.Getenv("FREEMAIL_DB_CREDENTIALS")) + vU := VirtualUser{} + vU.Email = "test@example.com" + /* + vU := VirtualUser{} + vU.Email = "test@example.com" + //if err := Db.Save(&vU); err != nil { + if !Db.NewRecord(&vU) { + //t.Fatal("Saving record to database failed.", err) + t.Fatal("Saving record to database failed.") + } + */ + if !EmailExists(vU.Email) { + t.Log(EmailExists(vU.Email)) + t.Fatal("Email should exist. Expected bool true.") + } + if EmailExists("foo@example.com") { + t.Fatal("Email doesn't exist. Expected bool false.") + } +} |
