MCPcopy Create free account
hub / github.com/goadesign/goa / TestFlowExprValidate

Function TestFlowExprValidate

expr/security_test.go:82–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

80}
81
82func TestFlowExprValidate(t *testing.T) {
83 var (
84 tokenURL = "http://example.com/token"
85 authorizationURL = "http://example.com/auth"
86 refreshURL = "http://example.com/refresh"
87 invalidURL = "http://%"
88 escapeError = url.EscapeError("%")
89 parseError = url.Error{Op: "parse", URL: invalidURL, Err: escapeError}
90 errInvalidTokenURL = fmt.Errorf("invalid token URL %q: %s", invalidURL, parseError.Error())
91 errInvalidAuthorizationURL = fmt.Errorf("invalid authorization URL %q: %s", invalidURL, parseError.Error())
92 errInvalidRefreshURL = fmt.Errorf("invalid refresh URL %q: %s", invalidURL, parseError.Error())
93 )
94 cases := map[string]struct {
95 tokenURL string
96 authorizationURL string
97 refreshURL string
98 expected *eval.ValidationErrors
99 }{
100 "no error": {
101 tokenURL: tokenURL,
102 authorizationURL: authorizationURL,
103 refreshURL: refreshURL,
104 expected: &eval.ValidationErrors{
105 Errors: []error{},
106 },
107 },
108 "invalid token url": {
109 tokenURL: invalidURL,
110 authorizationURL: authorizationURL,
111 refreshURL: refreshURL,
112 expected: &eval.ValidationErrors{
113 Errors: []error{
114 errInvalidTokenURL,
115 },
116 },
117 },
118 "invalid authorization url": {
119 tokenURL: tokenURL,
120 authorizationURL: invalidURL,
121 refreshURL: refreshURL,
122 expected: &eval.ValidationErrors{
123 Errors: []error{
124 errInvalidAuthorizationURL,
125 },
126 },
127 },
128 "invalid refresh url": {
129 tokenURL: tokenURL,
130 authorizationURL: authorizationURL,
131 refreshURL: invalidURL,
132 expected: &eval.ValidationErrors{
133 Errors: []error{
134 errInvalidRefreshURL,
135 },
136 },
137 },
138 "invalid token url, authorization url and refresh url": {
139 tokenURL: invalidURL,

Callers

nothing calls this directly

Calls 2

ValidateMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected