2019-06-03 09:32:43 +00:00
|
|
|
package arn_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-08-25 06:41:59 +00:00
|
|
|
"github.com/akyoto/assert"
|
2019-06-03 09:32:43 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewUser(t *testing.T) {
|
|
|
|
user := arn.NewUser()
|
|
|
|
|
|
|
|
assert.NotNil(t, user)
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.NotEqual(t, user.ID, "")
|
2019-06-03 09:32:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDatabaseErrorMessages(t *testing.T) {
|
|
|
|
_, err := arn.GetUser("NON EXISTENT USER ID")
|
|
|
|
|
|
|
|
// We need to make sure that non-existent records return "not found" in the error message.
|
|
|
|
assert.NotNil(t, err)
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.Contains(t, err.Error(), "not found")
|
2019-06-03 09:32:43 +00:00
|
|
|
}
|