-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create a little MockGitHub class for tests mocking out the github REST API #382
Comments
@kohsuke what do you think of the general idea? I've got a little spike going but thought I'd wait for your thoughts before i go further. Can query/add users/orgs so far - gotta figure out how to support creating repos etc... |
couldn't you do this w/ either way, i support this idea! |
This would be an excellent addition. |
Here's my first spike https://github.com/jstrachan/github-api/tree/mock-api so we can create a mock user + list the repos for the user & create a new repository. There's an issue printing out the repository though (ownerName issues) due to:
|
@jstrachan , my apologies for the delay. Yes, I think better testability would be great, and ability to mock things would be wonderful. I think @stephenc worked in some Jenkins plugins to extensively mock GH*** objects from literal JSON files. How can I help make this happen? |
there's a few projects I'd really like a simple mock implementation of
GitHub
for easier testing.I'm fine with it being pretty basic (and defaulting to just not finding stuff ;) but if it was able to find users/orgs/repos/PRs and whatnot from in memory objects it'd be super handy.
I started a little spike using a real JAXRS server side and tried reusing the DTOs from this excellent library; but the way the DTOs work they are kinda hard wired into the Requestor; so figure it was maybe simplest to just add a little MockGitHub derived class. By barely changing the code I was able to get something basic going without breaking the
GitHub
API or implementation.I can submit a little PR to show you the kinda thing am thinking. Its kinda an extension of the
offline
mode but just with a custom API that lets you populate some resources etcThe text was updated successfully, but these errors were encountered: