summaryrefslogtreecommitdiffstats
path: root/app/user_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-25 09:32:42 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-25 09:32:42 -0500
commitd245b29f82a03f1aff966a2fb2100a5703d82f32 (patch)
treecf204039af74fa2579e0291e9e595f08411b0a7a /app/user_test.go
parent8ed665cb76c0763e83a2949c4bdd70153baf72f7 (diff)
downloadchat-d245b29f82a03f1aff966a2fb2100a5703d82f32.tar.gz
chat-d245b29f82a03f1aff966a2fb2100a5703d82f32.tar.bz2
chat-d245b29f82a03f1aff966a2fb2100a5703d82f32.zip
More app code migration (#5170)
* Migrate admin functions into app package * More user function refactoring * Move post functions into app package
Diffstat (limited to 'app/user_test.go')
-rw-r--r--app/user_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/user_test.go b/app/user_test.go
index ce2249ca0..5b994d219 100644
--- a/app/user_test.go
+++ b/app/user_test.go
@@ -25,3 +25,29 @@ func TestIsUsernameTaken(t *testing.T) {
t.FailNow()
}
}
+
+func TestCheckUserDomain(t *testing.T) {
+ th := Setup().InitBasic()
+ user := th.BasicUser
+
+ cases := []struct {
+ domains string
+ matched bool
+ }{
+ {"simulator.amazonses.com", true},
+ {"gmail.com", false},
+ {"", true},
+ {"gmail.com simulator.amazonses.com", true},
+ }
+ for _, c := range cases {
+ matched := CheckUserDomain(user, c.domains)
+ if matched != c.matched {
+ if c.matched {
+ t.Logf("'%v' should have matched '%v'", user.Email, c.domains)
+ } else {
+ t.Logf("'%v' should not have matched '%v'", user.Email, c.domains)
+ }
+ t.FailNow()
+ }
+ }
+}