``` pip install pytest https://github.com/ArjanCodes/2022-test-existing-code/blob/main/after/pay/tests/test_payment.py dependency injection pytest.mark.parameterize mocker.patch('main.requests.get') assert_called_once_with ``` use `protocal` to mock data pytset.fixture https://typing.python.org/en/latest/spec/protocol.html#protocols ``` from pytest import MonkeyPatch def test_pay_order(monkeypatch: MonkeyPatch): inputs = ["1249190007575069", "12", "2024"] monkeypatch.setattr("builtins.input", lambda _: inputs.pop(0)) monkeypatch.setattr(PaymentProcessor, "_check_api_key", lambda _: True) ```