fix redirect to checkout when the org has not a subscription
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
from pprint import pprint
|
||||
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
||||
|
||||
from ...conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
@@ -20,9 +22,9 @@ def test_checkout(
|
||||
'org_id': 'f6000f79-6e5c-49a0-952f-3bda330ef278',
|
||||
'cnpj': '00000000000191',
|
||||
'name': 'Branco do Brasil',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
'payment_method': 'MANUAL',
|
||||
'user': {
|
||||
'email': 'bb@users.noreply.saladeaula.digital',
|
||||
'payment_method': 'BANK_SLIP',
|
||||
'created_by': {
|
||||
'id': '15bacf02-1535-4bee-9022-19d106fd7518',
|
||||
'name': 'Sérgio R Siqueira',
|
||||
},
|
||||
@@ -46,46 +48,50 @@ def test_checkout(
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
print(r)
|
||||
body = json.loads(r['body'])
|
||||
print(body)
|
||||
assert r['statusCode'] == HTTPStatus.CREATED
|
||||
|
||||
r = dynamodb_persistence_layer.collection.query(PartitionKey(body['id']))
|
||||
pprint(r['items'])
|
||||
|
||||
def test_checkout_from_user(
|
||||
app,
|
||||
seeds,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/orders',
|
||||
method=HTTPMethod.POST,
|
||||
body={
|
||||
'user_id': '15bacf02-1535-4bee-9022-19d106fd7518',
|
||||
'cpf': '07879819908',
|
||||
'name': 'Sérgio R Siqueira',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
'payment_method': 'MANUAL',
|
||||
'address': {
|
||||
'city': 'Curitiba',
|
||||
'postcode': '81280350',
|
||||
'neighborhood': 'Cidade Industrial',
|
||||
'address1': 'Rua Monsenhor Ivo Zanlorenzi',
|
||||
'address2': 'nº 5190, ap 1802',
|
||||
'state': 'PR',
|
||||
},
|
||||
'items': [
|
||||
{
|
||||
'id': 'e1c44881-2fe3-484e-ada2-12b6bf5b9398',
|
||||
'name': 'NR-35 Segurança nos Trabalhos em Altura',
|
||||
'quantity': 2,
|
||||
'unit_price': 119,
|
||||
}
|
||||
],
|
||||
},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
print(r)
|
||||
assert r['statusCode'] == HTTPStatus.CREATED
|
||||
|
||||
# def test_checkout_from_user(
|
||||
# app,
|
||||
# seeds,
|
||||
# http_api_proxy: HttpApiProxy,
|
||||
# dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
# lambda_context: LambdaContext,
|
||||
# ):
|
||||
# r = app.lambda_handler(
|
||||
# http_api_proxy(
|
||||
# raw_path='/orders',
|
||||
# method=HTTPMethod.POST,
|
||||
# body={
|
||||
# 'user_id': '15bacf02-1535-4bee-9022-19d106fd7518',
|
||||
# 'cpf': '07879819908',
|
||||
# 'name': 'Sérgio R Siqueira',
|
||||
# 'email': 'sergio@somosbeta.com.br',
|
||||
# 'payment_method': 'MANUAL',
|
||||
# 'address': {
|
||||
# 'city': 'Curitiba',
|
||||
# 'postcode': '81280350',
|
||||
# 'neighborhood': 'Cidade Industrial',
|
||||
# 'address1': 'Rua Monsenhor Ivo Zanlorenzi',
|
||||
# 'address2': 'nº 5190, ap 1802',
|
||||
# 'state': 'PR',
|
||||
# },
|
||||
# 'items': [
|
||||
# {
|
||||
# 'id': 'e1c44881-2fe3-484e-ada2-12b6bf5b9398',
|
||||
# 'name': 'NR-35 Segurança nos Trabalhos em Altura',
|
||||
# 'quantity': 2,
|
||||
# 'unit_price': 119,
|
||||
# }
|
||||
# ],
|
||||
# },
|
||||
# ),
|
||||
# lambda_context,
|
||||
# )
|
||||
# print(r)
|
||||
# assert r['statusCode'] == HTTPStatus.CREATED
|
||||
|
||||
Reference in New Issue
Block a user