update
This commit is contained in:
@@ -21,12 +21,14 @@ def test_get_policies(
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
assert json.loads(r['body']) == {
|
||||
expected = {
|
||||
'billing_policy': {'billing_day': 1, 'payment_method': 'PIX'},
|
||||
'payment_policy': {'due_days': 90},
|
||||
}
|
||||
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
assert json.loads(r['body']) == expected
|
||||
|
||||
|
||||
def test_put_policies(
|
||||
mock_app,
|
||||
@@ -67,7 +69,7 @@ def test_get_address(
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
address = {
|
||||
expected = {
|
||||
'id': 'cJtK9SsnJhKPyxESe7g3DG',
|
||||
'sk': 'metadata#address',
|
||||
'postcode': '88101001',
|
||||
@@ -78,7 +80,7 @@ def test_get_address(
|
||||
'state': 'SC',
|
||||
}
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
assert json.loads(r['body']) == address
|
||||
assert json.loads(r['body']) == expected
|
||||
|
||||
|
||||
def test_post_address(
|
||||
@@ -110,3 +112,61 @@ def test_post_address(
|
||||
)
|
||||
assert data['address1'] == 'Rua Monsenhor Ivo Zanlorenzi, 5190'
|
||||
assert data['postcode'] == '81280350'
|
||||
|
||||
|
||||
def test_get_custom_pricing(
|
||||
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/custompricing',
|
||||
method=HTTPMethod.GET,
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
|
||||
expected = {
|
||||
'items': [
|
||||
{
|
||||
'sk': 'COURSE#281198c2-f293-4acc-b96e-e4a2d5f6b73c',
|
||||
'unit_price': 199,
|
||||
'id': 'CUSTOM_PRICING#ORG#cJtK9SsnJhKPyxESe7g3DG',
|
||||
}
|
||||
],
|
||||
'last_key': None,
|
||||
}
|
||||
assert json.loads(r['body']) == expected
|
||||
|
||||
|
||||
def test_post_custom_pricing(
|
||||
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/custompricing',
|
||||
method=HTTPMethod.POST,
|
||||
body={
|
||||
'course_id': '15ee05a3-4ceb-4b7e-9979-db75b28c9ade',
|
||||
'unit_price': '99.3',
|
||||
},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.CREATED
|
||||
|
||||
data = dynamodb_persistence_layer.collection.get_item(
|
||||
KeyPair(
|
||||
'CUSTOM_PRICING#ORG#cJtK9SsnJhKPyxESe7g3DG',
|
||||
'COURSE#15ee05a3-4ceb-4b7e-9979-db75b28c9ade',
|
||||
)
|
||||
)
|
||||
|
||||
assert data
|
||||
|
||||
Reference in New Issue
Block a user