{"repo":"migueleliasweb/go-github-mock","free":true,"listed":false,"github":"https://github.com/migueleliasweb/go-github-mock","clone":"git clone https://github.com/migueleliasweb/go-github-mock.git","description":"A library to aid unittesting code that uses Golang's Github SDK","language":"Go","stars":140,"topics":["golang","testing","go","mock","mocking","github","sdk","go-github"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"go-github-mock A library to aid unittesting code that uses Golang's Github SDK Installation Features - Create mocks for successive calls for the same endpoint - Pagination support (see mock.WithRequestMatchPages ) - Mock error returns - High level abstraction helps writing readabe unittests (see mock.WithRequestMatch ) - Lower level abstraction for advanced uses (see mock.WithRequestMatchHandler ) - Mock rate limiting errors from the api (see mock.WithRateLimit ) Examples Multiple requests Returning empty results Mocking errors from the API Mocking with pagination Mocking for GitHub Enterprise Github Enterprise uses a different prefix for its endpoints. In order to use the correct endpoints, please use the different set of Enterprise options: - WithRequestMatchEnterprise - WithRequestMatchPagesEnterprise Mocking with rate limits WithRateLimit uses a single rate-limiting middleware across all endpoints on the mock router. NOTE: This is an alpha feature. Future changes might break compatibility, until a stable version is released. Why Some conversations got started on go-github#1800 since go-github didn't provide an interface that could be easily reimplemented for unittests. After lots of conversations from the folks from go-github and quite a few PR ideas later, this style of testing was deemed not suitable to be part of the core SDK as it's not a feature of the API itself. Nonetheless, the ability of writing unittests for code that uses the go-github package is critical. A re","default_branch":null,"files":null,"tree":[],"storefront":"/r/migueleliasweb","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/migueleliasweb/go-github-mock/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}