add user to org
This commit is contained in:
@@ -37,3 +37,60 @@ def test_get_orgs(
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
|
||||
|
||||
def test_add_user(
|
||||
app,
|
||||
seeds,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/users',
|
||||
method=HTTPMethod.POST,
|
||||
body={
|
||||
'user': {
|
||||
'name': 'Sérgio R Siqueira',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
'cpf': '07879819908',
|
||||
},
|
||||
'org': {
|
||||
'id': 'f6000f79-6e5c-49a0-952f-3bda330ef278',
|
||||
'name': 'Branco do Brasil',
|
||||
'cnpj': '00000000000191',
|
||||
},
|
||||
},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.CREATED
|
||||
|
||||
|
||||
def test_org_not_found(
|
||||
app,
|
||||
seeds,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/users',
|
||||
method=HTTPMethod.POST,
|
||||
body={
|
||||
'user': {
|
||||
'name': 'Sérgio R Siqueira',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
'cpf': '07879819908',
|
||||
},
|
||||
'org': {
|
||||
'id': '123',
|
||||
'name': 'Banco do Brasil',
|
||||
'cnpj': '00000000000191',
|
||||
},
|
||||
},
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
body = json.loads(r['body'])
|
||||
assert body['type'] == 'OrgMissingError'
|
||||
|
||||
Reference in New Issue
Block a user