I wrote some tests for the logshare package which mainly tests the following:
The construction of the API enpoint
The auth headers
The presence of the query params
The status code handling on response
Please note that for these tests I had to enable the usage of a custom http.Client and an ApiUrl, so instead of doing the call to the actual API, it would do it to a mock httptest.Server.
I wrote some tests for the logshare package which mainly tests the following:
Please note that for these tests I had to enable the usage of a custom
http.Client
and anApiUrl
, so instead of doing the call to the actual API, it would do it to a mockhttptest.Server
.