| 1 | package g8scip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/ |
| 2 | |
| 3 | import "testingscip-go gomod github.com/golang/go/src go1.23.3 testing/" |
| 4 | |
| 5 | func TestAuthorizationService_Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/TestAuthorizationService_Authorize().(t *testingscip-go gomod github.com/golang/go/src go1.23.3 testing/.Tscip-go gomod github.com/golang/go/src go1.23.3 testing/T#) { |
| 6 | authorizationService := NewAuthorizationServicescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewAuthorizationService().().WithTokenscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#WithToken().("token") |
| 7 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", nil); !authorized { |
| 8 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 9 | } |
| 10 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("bad-token", nil); authorized { |
| 11 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 12 | } |
| 13 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"admin"}); authorized { |
| 14 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 15 | } |
| 16 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("", nil); authorized { |
| 17 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | func TestAuthorizationService_AuthorizeWithPermissionsscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/TestAuthorizationService_AuthorizeWithPermissions().(t *testingscip-go gomod github.com/golang/go/src go1.23.3 testing/.Tscip-go gomod github.com/golang/go/src go1.23.3 testing/T#) { |
| 22 | authorizationService := NewAuthorizationServicescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewAuthorizationService().().WithClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#WithClient().(NewClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewClient().("token").WithPermissionsscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/Client#WithPermissions().([]string{"a", "b"})) |
| 23 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", nil); !authorized { |
| 24 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 25 | } |
| 26 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"a"}); !authorized { |
| 27 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 28 | } |
| 29 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"b"}); !authorized { |
| 30 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 31 | } |
| 32 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"a", "b"}); !authorized { |
| 33 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 34 | } |
| 35 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"c"}); authorized { |
| 36 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 37 | } |
| 38 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"a", "c"}); authorized { |
| 39 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 40 | } |
| 41 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("bad-token", nil); authorized { |
| 42 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 43 | } |
| 44 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("bad-token", []string{"a"}); authorized { |
| 45 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 46 | } |
| 47 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("", []string{"a"}); authorized { |
| 48 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestAuthorizationService_WithTokenscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/TestAuthorizationService_WithToken().(t *testingscip-go gomod github.com/golang/go/src go1.23.3 testing/.Tscip-go gomod github.com/golang/go/src go1.23.3 testing/T#) { |
| 53 | authorizationService := NewAuthorizationServicescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewAuthorizationService().().WithTokenscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#WithToken().("token") |
| 54 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", nil); !authorized { |
| 55 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 56 | } |
| 57 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("bad-token", nil); authorized { |
| 58 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 59 | } |
| 60 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"admin"}); authorized { |
| 61 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | func TestAuthorizationService_WithTokensscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/TestAuthorizationService_WithTokens().(t *testingscip-go gomod github.com/golang/go/src go1.23.3 testing/.Tscip-go gomod github.com/golang/go/src go1.23.3 testing/T#) { |
| 66 | authorizationService := NewAuthorizationServicescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewAuthorizationService().().WithTokensscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#WithTokens().([]string{"1", "2"}) |
| 67 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("1", nil); !authorized { |
| 68 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 69 | } |
| 70 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("2", nil); !authorized { |
| 71 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 72 | } |
| 73 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("3", nil); authorized { |
| 74 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func TestAuthorizationService_WithClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/TestAuthorizationService_WithClient().(t *testingscip-go gomod github.com/golang/go/src go1.23.3 testing/.Tscip-go gomod github.com/golang/go/src go1.23.3 testing/T#) { |
| 79 | authorizationService := NewAuthorizationServicescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewAuthorizationService().().WithClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#WithClient().(NewClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewClient().("token").WithPermissionsscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/Client#WithPermissions().([]string{"a", "b"})) |
| 80 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"a", "b"}); !authorized { |
| 81 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 82 | } |
| 83 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"a"}); !authorized { |
| 84 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 85 | } |
| 86 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"b"}); !authorized { |
| 87 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 88 | } |
| 89 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("token", []string{"c"}); authorized { |
| 90 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestAuthorizationService_WithClientsscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/TestAuthorizationService_WithClients().(t *testingscip-go gomod github.com/golang/go/src go1.23.3 testing/.Tscip-go gomod github.com/golang/go/src go1.23.3 testing/T#) { |
| 95 | authorizationService := NewAuthorizationServicescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewAuthorizationService().().WithClientsscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#WithClients().([]*Clientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/Client#{NewClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewClient().("1").WithPermissionscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/Client#WithPermission().("a"), NewClientscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/NewClient().("2").WithPermissionscip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/Client#WithPermission().("b")}) |
| 96 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("1", []string{"a"}); !authorized { |
| 97 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 98 | } |
| 99 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("2", []string{"b"}); !authorized { |
| 100 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned true") |
| 101 | } |
| 102 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("1", []string{"b"}); authorized { |
| 103 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 104 | } |
| 105 | if _, authorized := authorizationService.Authorizescip-go gomod github.com/TwiN/g8/v3 . `github.com/TwiN/g8/v3`/AuthorizationService#Authorize().("2", []string{"a"}); authorized { |
| 106 | t.Errorscip-go gomod github.com/golang/go/src go1.23.3 testing/common#Error().("should've returned false") |
| 107 | } |
| 108 | } |