canonical / pebble

Take control of your internal daemons!
https://canonical-pebble.readthedocs-hosted.com/
GNU General Public License v3.0
143 stars 54 forks source link

Refactor client test framework now that Requester is merged #315

Open flotter opened 11 months ago

flotter commented 11 months ago

@flotter and @anpep have an outstanding task to refactor the client test framework to better utilise the Requester interface (#310). At the moment the test framework cannot use Requester Do() due to client.response type not used in the response body. We should also ensure all areas are properly covered.

flotter commented 11 months ago

Comment from Ben:

func (client *Client) SetDoer(d doer) {
    client.doer = d
    client.Requester().(*defaultRequester).doer = d

Should this SetDoer method be moved to a test method/function? I believe external packages can't actually call it anyway, as the doer interface isn't exported. But happy to leave this to another PR if you prefer.

flotter commented 11 months ago

Comment from Ben:

It looks like we're never setting the baseURL field -- oversight? We do use it in dispatch (somewhat surprised there's not a test for this -- we should probably add one).