(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestInputFileWithGETAndPOST(t *testing.T) { |
| 63 | |
| 64 | input := NewTestInput() |
| 65 | rg := NewRequestGenerator([]PluginReader{input}, func() { |
| 66 | input.EmitGET() |
| 67 | input.EmitPOST() |
| 68 | }, 2) |
| 69 | readPayloads := []*Message{} |
| 70 | |
| 71 | // Given a capture file with a GET request |
| 72 | expectedCaptureFile := CreateCaptureFile(rg) |
| 73 | defer expectedCaptureFile.TearDown() |
| 74 | |
| 75 | // When the requests are read from the capture file |
| 76 | err := ReadFromCaptureFile(expectedCaptureFile.file, 2, func(msg *Message) { |
| 77 | readPayloads = append(readPayloads, msg) |
| 78 | }) |
| 79 | |
| 80 | // The read requests should match the original request |
| 81 | if err != nil { |
| 82 | t.Error(err) |
| 83 | } else if !expectedCaptureFile.PayloadsEqual(readPayloads) { |
| 84 | t.Error("Request read back from file should match") |
| 85 | |
| 86 | } |
| 87 | |
| 88 | } |
| 89 | |
| 90 | func TestInputFileMultipleFilesWithRequestsOnly(t *testing.T) { |
| 91 | rnd := rand.Int63() |
nothing calls this directly
no test coverage detected