Since we are using Go's httptest to simulate our IntelOwl server through by creating a mock test server from httptest.Server and using httptest.ServeMux as a router to implement our mock responses on the specified endpoint
Right now we need are initializing the test server with every test. By using gorilla/mux we can implement a request method-based router from which we only need to set up the test server once and keep using that for every test!
To implement a common setup and teardown we can use TestMain. For more information, you can read about it here.
Since we are using Go's
httptestto simulate ourIntelOwlserver through by creating a mock test server fromhttptest.Serverand usinghttptest.ServeMuxas a router to implement our mock responses on the specified endpointRight now we need are initializing the test server with every test. By using gorilla/mux we can implement a request method-based router from which we only need to set up the test server once and keep using that for every test!
To implement a common setup and teardown we can use
TestMain. For more information, you can read about it here.