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 ?
|
# 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"]
|
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']:
|
for link_obj in order_response.json()['links']:
|
||||||
if link_obj['rel'] == 'approve':
|
if link_obj['rel'] == 'approve':
|
||||||
forward_to_user_link = link_obj['href']
|
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}')
|
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
|
# 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"]
|
# order_id = json.loads(response.text)["id"]
|
||||||
|
|
||||||
|
|||||||
@@ -29,18 +29,25 @@ def test_nearby(client): # pylint: disable=redefined-outer-name
|
|||||||
response = client.post(
|
response = client.post(
|
||||||
url=f"/orders/new/",
|
url=f"/orders/new/",
|
||||||
json={
|
json={
|
||||||
'user_id': supabase.SUPABASE_TEST_USER_ID
|
'user_id': supabase.SUPABASE_TEST_USER_ID,
|
||||||
'basket': {
|
'basket': {
|
||||||
|
{
|
||||||
}
|
'id': '1873672819',
|
||||||
'currency':
|
'quantity': 1982
|
||||||
'return_url_success':
|
},
|
||||||
'return_url_failure':
|
{
|
||||||
|
'id': '9876789',
|
||||||
|
'quantity': 1982
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'currency': 'CHF',
|
||||||
|
'return_url_success': 'https://anydev.info',
|
||||||
|
'return_url_failure': 'https://anydev.info'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
suggestions = response.json()
|
suggestions = response.json()
|
||||||
|
|
||||||
# checks :
|
# 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 isinstance(suggestions, list) # check that the return type is a list
|
||||||
assert len(suggestions) > 0
|
assert len(suggestions) > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user