Gogs.HTTPoisonMock (gogs v1.1.0)

Mock (stub) our API requests to the Gogs API so that we can test all of our code (with Mocks) on GitHub CI. These functions pattern match on the params and return the expected responses. If you know of a better way of doing this (preferably without introducing more dependencies ...) Please share: github.com/dwyl/gogs/issues

Link to this section Summary

Functions

delete/1 mocks the HTTPoison delete function. Feel free refactor this if you can make it pretty.

get/2 mocks the HTTPoison.get/2 function when parameters match test vars. Feel free refactor this if you can make it pretty.

post/3 mocks the HTTPoison.post/3 function when parameters match test vars. Feel free refactor this if you can make it pretty.

post_raw/3 mocks the GogsHttp.post_raw/3 function. Feel free refactor this if you can make it pretty.

Link to this section Functions

delete/1 mocks the HTTPoison delete function. Feel free refactor this if you can make it pretty.

Link to this function

get(url, headers)

get/2 mocks the HTTPoison.get/2 function when parameters match test vars. Feel free refactor this if you can make it pretty.

Link to this function

make_repo_create_post_response_body(repo_name)

Link to this function

post(url, body, headers)

post/3 mocks the HTTPoison.post/3 function when parameters match test vars. Feel free refactor this if you can make it pretty.

Link to this function

post_raw_html(url, body, headers)

post_raw/3 mocks the GogsHttp.post_raw/3 function. Feel free refactor this if you can make it pretty.