Skip to content

Conversation

allisonkarlitskaya
Copy link
Member

This might be useful to help us do a more-complete mocking of github...

Write a small job-runner test based on this (although this isn't proper unit testing in any sense)

This might be useful to help us do a more-complete mocking of github...

Write a small job-runner test based on this (although this isn't
proper unit testing in any sense)
status, _, reason = message.get('Status', '200 OK').partition(' ')
return web.Response(status=int(status), reason=reason, headers=dict(message), body=body)

return await repository(request).http_backend(request)

Check warning

Code scanning / CodeQL

Unreachable code

This statement is unreachable.
@martinpitt martinpitt removed their request for review April 23, 2024 04:09
@jscotka
Copy link
Collaborator

jscotka commented Aug 29, 2024

Hi @allisonkarlitskaya We've done somethins similar for packit projects, to mock whole communication with gitlab/github

https://github.com/packit/requre

usage is then like:
https://github.com/packit/ogr/blob/main/tests/integration/github/test_pull_requests.py#L12
then you have to run it first time it stores all necessary communication, and then in test it replay it back to code.

In this case it mocks python github library communication,
but possible to use if to wrap any especially remote communication.

There exists also projects like: https://vcrpy.readthedocs.io/en/latest/ but these projects are simplier and we've needed also to cover e.g. also SOAP/XML-RPC api, what was not covered by this.

@allisonkarlitskaya
Copy link
Member Author

hi @jscotka, thanks for the link.

We already have a few different versions of mocked GitHub API as well, but the thing that this PR aims to do is to enable serving of the repo content as well, so that you can do things like git clone against the mock server. Is that implemented as well in your solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants