From fd3fa8f8dcfa5de42a16db9b62e1d6628f43b0fd Mon Sep 17 00:00:00 2001 From: Adrian Carolli Date: Fri, 5 Jan 2018 14:46:48 -0500 Subject: [PLT-7793] Added /users/tokens endpoint (#8038) * Added /users/tokens/all endpoint - UserAccessStore now has getAll method - Added tests - Added route - Added handler * Remove space fix check-style * Remove blank space check-style * Fixes for make check-style * Remove extra code that is un-needed in user_test.go * Rename endpoint + grammar - Renamed /users/tokens/all to /users/tokens - Renamed getUserAccessTokens to getUserAccessTokensForUser - Renamed getAllUserAccessTokens to getUserAccessTokens - Minor Grammar changes * Add localization for sql_user_access_token.get_all * Fix minor plural spelling --- api4/user_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'api4/user_test.go') diff --git a/api4/user_test.go b/api4/user_test.go index fb9222d8f..7b103d23b 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -2450,6 +2450,23 @@ func TestGetUserAccessToken(t *testing.T) { if len(rtokens) != 2 { t.Fatal("should have 2 tokens") } + + _, resp = Client.GetUserAccessTokens(0,100) + CheckForbiddenStatus(t, resp) + + rtokens, resp = AdminClient.GetUserAccessTokens(1,1) + CheckNoError(t, resp) + + if len(rtokens) != 1 { + t.Fatal("should have 1 token") + } + + rtokens, resp = AdminClient.GetUserAccessTokens(0,2) + CheckNoError(t, resp) + + if len(rtokens) != 2 { + t.Fatal("should have 2 tokens") + } } func TestRevokeUserAccessToken(t *testing.T) { -- cgit v1.2.3-1-g7c22