summaryrefslogtreecommitdiffstats
path: root/models/user_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/user_test.go')
-rw-r--r--models/user_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/user_test.go b/models/user_test.go
index 35efc3959a..f0a8dbdd47 100644
--- a/models/user_test.go
+++ b/models/user_test.go
@@ -23,6 +23,23 @@ func TestGetUserEmailsByNames(t *testing.T) {
assert.Equal(t, []string{"user8@example.com", "user5@example.com"}, GetUserEmailsByNames([]string{"user8", "user5"}))
}
+func TestUser_APIFormat(t *testing.T) {
+
+ user, err := GetUserByID(1)
+ assert.NoError(t, err)
+ assert.True(t, user.IsAdmin)
+
+ apiUser := user.APIFormat()
+ assert.True(t, apiUser.IsAdmin)
+
+ user, err = GetUserByID(2)
+ assert.NoError(t, err)
+ assert.False(t, user.IsAdmin)
+
+ apiUser = user.APIFormat()
+ assert.False(t, apiUser.IsAdmin)
+}
+
func TestCanCreateOrganization(t *testing.T) {
assert.NoError(t, PrepareTestDatabase())