Created
September 2, 2022 06:39
-
-
Save mojtabaahn/f4c7ce7eb65efad50a1d090cd5d8572e to your computer and use it in GitHub Desktop.
Mocking SDKs in python [2]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from httpx import Response, Client | |
from app import app | |
from factories import UserFactory, BasketFactory | |
def test_purchase_basket_controller(): | |
with Client(app=app, base_url="http://testserver.test", timeout=0.1) as client: | |
user = UserFactory.create_one() | |
basket = BasketFactory.create_one(user_id=user.id) | |
response = client.post( | |
url='/basket/purchase', | |
headers=dict(Accept='application/json') | |
) | |
assert response.status_code == 307 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment