Merge modifications for more separate backend functions #69
@@ -30,7 +30,8 @@ validation_response = requests.post(
|
||||
)
|
||||
|
||||
# todo check status code + try except. Status code 201 ?
|
||||
print(validation_response.text)
|
||||
print(f'Reponse status code: {validation_response.status_code}')
|
||||
print(f'Access token: {json.loads(validation_response.text)["access_token"]}')
|
||||
access_token = json.loads(validation_response.text)["access_token"]
|
||||
|
||||
|
||||
@@ -87,8 +88,9 @@ order_response = requests.post(
|
||||
for link_obj in order_response.json()['links']:
|
||||
if link_obj['rel'] == 'approve':
|
||||
forward_to_user_link = link_obj['href']
|
||||
print(f'Reponse status code: {order_response.status_code}')
|
||||
print(f'Follow this link to proceed to payment: {forward_to_user_link}')
|
||||
# order_id = json.loads(order_response.text)["id"]
|
||||
order_id = json.loads(order_response.text)["id"]
|
||||
|
||||
|
||||
#%%
|
||||
@@ -104,6 +106,6 @@ capture_response = requests.post(
|
||||
)
|
||||
|
||||
# todo check status code + try except
|
||||
print(capture_response.json())
|
||||
print(f'Reponse status code: {capture_response.status_code}')
|
||||
print(capture_response.text)
|
||||
# order_id = json.loads(response.text)["id"]
|
||||
|
||||
|
||||
@@ -29,18 +29,25 @@ def test_nearby(client): # pylint: disable=redefined-outer-name
|
||||
response = client.post(
|
||||
url=f"/orders/new/",
|
||||
json={
|
||||
'user_id': supabase.SUPABASE_TEST_USER_ID
|
||||
'user_id': supabase.SUPABASE_TEST_USER_ID,
|
||||
'basket': {
|
||||
|
||||
}
|
||||
'currency':
|
||||
'return_url_success':
|
||||
'return_url_failure':
|
||||
{
|
||||
'id': '1873672819',
|
||||
'quantity': 1982
|
||||
},
|
||||
{
|
||||
'id': '9876789',
|
||||
'quantity': 1982
|
||||
}
|
||||
},
|
||||
'currency': 'CHF',
|
||||
'return_url_success': 'https://anydev.info',
|
||||
'return_url_failure': 'https://anydev.info'
|
||||
}
|
||||
)
|
||||
suggestions = response.json()
|
||||
|
||||
# checks :
|
||||
assert response.status_code == status_code # check for successful planning
|
||||
assert response.status_code == 200 # check for successful planning
|
||||
assert isinstance(suggestions, list) # check that the return type is a list
|
||||
assert len(suggestions) > 0
|
||||
|
||||
Reference in New Issue
Block a user