defl/todo.md
2025-04-28 14:44:03 -04:00

22 lines
613 B
Markdown

```
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)
```