Skip to content
Snippets Groups Projects
Commit 69273a27 authored by Will McCutchen's avatar Will McCutchen
Browse files

Test base64 corner cases

parent 2fcb4a9b
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ func assertContentType(t *testing.T, w *httptest.ResponseRecorder, contentType s ...@@ -54,7 +54,7 @@ func assertContentType(t *testing.T, w *httptest.ResponseRecorder, contentType s
func assertBodyContains(t *testing.T, w *httptest.ResponseRecorder, needle string) { func assertBodyContains(t *testing.T, w *httptest.ResponseRecorder, needle string) {
if !strings.Contains(w.Body.String(), needle) { if !strings.Contains(w.Body.String(), needle) {
t.Fatalf("expected string %v in body", needle) t.Fatalf("expected string %q in body %q", needle, w.Body.String())
} }
} }
...@@ -2254,6 +2254,22 @@ func TestBase64(t *testing.T) { ...@@ -2254,6 +2254,22 @@ func TestBase64(t *testing.T) {
"/base64/decode/" + randStringBytes(Base64MaxLen+1), "/base64/decode/" + randStringBytes(Base64MaxLen+1),
"Cannot handle input", "Cannot handle input",
}, },
{
"/base64/",
"No input data",
},
{
"/base64/decode/",
"No input data",
},
{
"/base64/decode/dmFsaWRfYmFzZTY0X2VuY29kZWRfc3RyaW5n/extra",
"Invalid URL",
},
{
"/base64/unknown/dmFsaWRfYmFzZTY0X2VuY29kZWRfc3RyaW5n",
"Invalid operation: unknown",
},
} }
for _, test := range errorTests { for _, test := range errorTests {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment