(t *testing.T)
| 33 | ) |
| 34 | |
| 35 | func TestParseRFC7231Time(t *testing.T) { |
| 36 | testCases := []struct { |
| 37 | timeStr string |
| 38 | expectedSuccess bool |
| 39 | }{ |
| 40 | { |
| 41 | timeStr: "Sun, 2 Jan 2000 20:34:56 GMT", |
| 42 | expectedSuccess: true, |
| 43 | }, |
| 44 | { |
| 45 | timeStr: "Sun, 02 Jan 2000 20:34:56 GMT", |
| 46 | expectedSuccess: true, |
| 47 | }, |
| 48 | { |
| 49 | timeStr: "Sun, 2 Jan 00 20:34:56 GMT", |
| 50 | expectedSuccess: true, |
| 51 | }, |
| 52 | { |
| 53 | timeStr: "Sun, 02 Jan 00 20:34:56 GMT", |
| 54 | expectedSuccess: true, |
| 55 | }, |
| 56 | { |
| 57 | timeStr: "Su, 2 Jan 00 20:34:56 GMT", |
| 58 | expectedSuccess: false, |
| 59 | }, |
| 60 | } |
| 61 | for _, testCase := range testCases { |
| 62 | testCase := testCase |
| 63 | t.Run("", func(t *testing.T) { |
| 64 | _, err := parseRFC7231Time(testCase.timeStr) |
| 65 | if err != nil && testCase.expectedSuccess { |
| 66 | t.Errorf("expected success found failure %v", err) |
| 67 | } |
| 68 | if err == nil && !testCase.expectedSuccess { |
| 69 | t.Errorf("expected failure found success") |
| 70 | } |
| 71 | }) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | // Tests signature redacting function used |
| 76 | // in filtering on-wire Authorization header. |
nothing calls this directly
no test coverage detected