import pytest
from httprequests import FauxRequests

@pytest.fixture(scope="module")
def http():
    return FauxRequests()

def get(http):
    resp = http.get("https://example.org/")
    assert resp.status_code == 200
    assert resp.headers

def params(http):
    resp = http.get("https://httpbin.org/get", params={"key":"val"})
    assert resp.json()["args"]["key"] == "val"

def post(http):
    resp = http.post("https://httpbin.org/post", data={"a":"b", "c":"d"})
    assert resp.json()["form"]["a"] == "b"

def json(http):
    resp = http.get("https://httpbin.org/json")
    assert resp.json()
