File tree 1 file changed +0
-25
lines changed
1 file changed +0
-25
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,8 @@ package csrf
2
2
3
3
import (
4
4
"bytes"
5
- "crypto/rand"
6
5
"encoding/base64"
7
6
"fmt"
8
- "io"
9
7
"log"
10
8
"mime/multipart"
11
9
"net/http"
@@ -201,29 +199,6 @@ func TestXOR(t *testing.T) {
201
199
}
202
200
}
203
201
204
- // shortReader provides a broken implementation of io.Reader for testing.
205
- type shortReader struct {}
206
-
207
- func (sr shortReader ) Read (p []byte ) (int , error ) {
208
- return len (p ) % 2 , io .ErrUnexpectedEOF
209
- }
210
-
211
- // TestGenerateRandomBytes tests the (extremely rare) case that crypto/rand does
212
- // not return the expected number of bytes.
213
- func TestGenerateRandomBytes (t * testing.T ) {
214
- // Pioneered from https://github.com/justinas/nosurf
215
- original := rand .Reader
216
- rand .Reader = shortReader {}
217
- defer func () {
218
- rand .Reader = original
219
- }()
220
-
221
- b , err := generateRandomBytes (tokenLength )
222
- if err == nil {
223
- t .Fatalf ("generateRandomBytes did not report a short read: only read %d bytes" , len (b ))
224
- }
225
- }
226
-
227
202
func TestTemplateField (t * testing.T ) {
228
203
s := http .NewServeMux ()
229
204
You can’t perform that action at this time.
0 commit comments