-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added http mocks to the testing + Ihttoptions interface
- Loading branch information
1 parent
69ae672
commit 4993201
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package mock_executor | ||
|
||
import ( | ||
"soarca/utils/http" | ||
|
||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockHttpOptions struct { | ||
mock.Mock | ||
} | ||
|
||
type MockHttpRequest struct { | ||
mock.Mock | ||
} | ||
|
||
func (httpOptions *MockHttpOptions) ExtractUrl() (string, error) { | ||
args := httpOptions.Called() | ||
return args.String(0), args.Error(1) | ||
} | ||
|
||
func (httpOptions *MockHttpRequest) Request(options http.HttpOptions) ([]byte, error) { | ||
args := httpOptions.Called(options) | ||
return args.Get(0).([]byte), args.Error(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters