Skip to content
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

Add new global fixture to mock HTTP requests #8276

Merged
merged 2 commits into from
Dec 31, 2020
Merged

Add new global fixture to mock HTTP requests #8276

merged 2 commits into from
Dec 31, 2020

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Dec 31, 2020

What does this PR do?

This adds a new global fixture that returns a function used to mock HTTP requests for the lifetime of a test

Motivation

I am using this in a feature branch and realized we often need this

Example

def test(mock_http_response):
    mock_http_response(
        """
        # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
        # TYPE go_memstats_alloc_bytes gauge
        go_memstats_alloc_bytes 6.396288e+06
        """
    )
    ...

@ofek ofek requested a review from a team as a code owner December 31, 2020 19:22
@ofek ofek merged commit 2e5a4b3 into master Dec 31, 2020
@ofek ofek deleted the ofek/mock branch December 31, 2020 19:33
@ofek ofek mentioned this pull request Mar 29, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant