update address
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from layercake.dynamodb import DynamoDBCollection, DynamoDBPersistenceLayer, KeyPair
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
@@ -46,6 +46,66 @@ def test_put_policies(
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
|
||||
collect = DynamoDBCollection(dynamodb_persistence_layer)
|
||||
course = collect.get_item(KeyPair('cJtK9SsnJhKPyxESe7g3DG', '0'))
|
||||
course = dynamodb_persistence_layer.collection.get_item(
|
||||
KeyPair('cJtK9SsnJhKPyxESe7g3DG', '0')
|
||||
)
|
||||
assert course['name'] == 'EDUSEG'
|
||||
|
||||
|
||||
def test_get_address(
|
||||
mock_app,
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = mock_app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/orgs/cJtK9SsnJhKPyxESe7g3DG/address',
|
||||
method=HTTPMethod.GET,
|
||||
body={'payment_policy': None},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
address = {
|
||||
'id': 'cJtK9SsnJhKPyxESe7g3DG',
|
||||
'sk': 'metadata#address',
|
||||
'postcode': '88101001',
|
||||
'address1': 'Av. Presidente Kennedy, 815',
|
||||
'address2': 'Sala 1',
|
||||
'neighborhood': 'Campinas',
|
||||
'city': 'São José',
|
||||
'state': 'SC',
|
||||
}
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
assert json.loads(r['body']) == address
|
||||
|
||||
|
||||
def test_post_address(
|
||||
mock_app,
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = mock_app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/orgs/cJtK9SsnJhKPyxESe7g3DG/address',
|
||||
method=HTTPMethod.POST,
|
||||
body={
|
||||
'postcode': '81280350',
|
||||
'address1': 'Rua Monsenhor Ivo Zanlorenzi, 5190',
|
||||
'address2': 'ap 1802',
|
||||
'neighborhood': 'Cidade Industrial',
|
||||
'city': 'Curitiba',
|
||||
'state': 'PR',
|
||||
},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
|
||||
data = dynamodb_persistence_layer.collection.get_item(
|
||||
KeyPair('cJtK9SsnJhKPyxESe7g3DG', 'metadata#address')
|
||||
)
|
||||
assert data['address1'] == 'Rua Monsenhor Ivo Zanlorenzi, 5190'
|
||||
|
||||
Reference in New Issue
Block a user