add orgs
This commit is contained in:
@@ -16,6 +16,6 @@ def get_orgs(user_id: str):
|
||||
|
||||
return dyn.collection.query(
|
||||
# Post-migration (users): rename `orgs` to `ORG`
|
||||
key=KeyPair(user_id, 'orgs'),
|
||||
key=KeyPair(user_id, 'orgs#'),
|
||||
start_key=start_key,
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@ AWSTemplateFormatVersion: "2010-09-09"
|
||||
Transform: "AWS::Serverless-2016-10-31"
|
||||
|
||||
Parameters:
|
||||
UsersTable:
|
||||
UserTable:
|
||||
Type: String
|
||||
Default: betaeducacao-prod-users_d2o3r5gmm4it7j
|
||||
CourseTable:
|
||||
@@ -34,8 +34,10 @@ Globals:
|
||||
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
|
||||
POWERTOOLS_LOGGER_LOG_EVENT: true
|
||||
DYNAMODB_PARTITION_KEY: id
|
||||
USER_TABLE: !Ref UserTable
|
||||
COURSE_TABLE: !Ref CourseTable
|
||||
ENROLLMENT_TABLE: !Ref EnrollmentTable
|
||||
ORDER_TABLE: !Ref OrderTable
|
||||
BUCKET_NAME: !Ref BucketName
|
||||
|
||||
Resources:
|
||||
|
||||
@@ -17,6 +17,7 @@ SK = 'sk'
|
||||
def pytest_configure():
|
||||
os.environ['TZ'] = 'America/Sao_Paulo'
|
||||
os.environ['COURSE_TABLE'] = PYTEST_TABLE_NAME
|
||||
os.environ['USER_TABLE'] = PYTEST_TABLE_NAME
|
||||
os.environ['BUCKET_NAME'] = 'saladeaula.digital'
|
||||
os.environ['DYNAMODB_PARTITION_KEY'] = PK
|
||||
os.environ['DYNAMODB_SORT_KEY'] = SK
|
||||
|
||||
19
api.saladeaula.digital/tests/routes/test_users.py
Normal file
19
api.saladeaula.digital/tests/routes/test_users.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from http import HTTPMethod, HTTPStatus
|
||||
|
||||
from ..conftest import HttpApiProxy, LambdaContext
|
||||
|
||||
|
||||
def test_get_orgs(
|
||||
app,
|
||||
seeds,
|
||||
http_api_proxy: HttpApiProxy,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
r = app.lambda_handler(
|
||||
http_api_proxy(
|
||||
raw_path='/users/213a6682-2c59-4404-9189-12eec0a846d4/orgs',
|
||||
method=HTTPMethod.GET,
|
||||
),
|
||||
lambda_context,
|
||||
)
|
||||
assert r['statusCode'] == HTTPStatus.OK
|
||||
@@ -1 +1,4 @@
|
||||
{"id": "2a8963fc-4694-4fe2-953a-316d1b10f1f5", "sk": "0", "name": "pytest" }
|
||||
|
||||
// User orgs
|
||||
{"id": "213a6682-2c59-4404-9189-12eec0a846d4", "sk": "orgs#286f7729-7765-482a-880a-0b153ea799be", "name": "ACME", "cnpj": "00000000000191"}
|
||||
Reference in New Issue
Block a user