Skip to content

Commit

Permalink
Add test cases for giving only body (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne authored Oct 10, 2020
1 parent c99f35e commit 3d5b989
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestMakeOptions(t *testing.T) {
{
name: "duration less than 0",
cli: &cli{
method: "WRONG",
method: "GET",
duration: -1,
},
want: nil,
Expand Down Expand Up @@ -181,6 +181,29 @@ func TestMakeOptions(t *testing.T) {
want: nil,
wantErr: true,
},
{
name: "body given",
cli: &cli{
method: "GET",
duration: 1,
headers: []string{"key:value"},
body: `{"foo": 1}`,
},
want: &attacker.Options{
Rate: 0,
Duration: 1,
Timeout: 0,
Method: "GET",
Body: []byte(`{"foo": 1}`),
Header: http.Header{
"key": []string{"value"},
},
Workers: 0,
MaxWorkers: 0,
MaxBody: 0,
},
wantErr: false,
},
{
name: "body file given",
cli: &cli{
Expand Down

0 comments on commit 3d5b989

Please sign in to comment.