def test_create_survey(dynamodb_table): from src.data.create_survey import create_survey survey_instance = StubSurvey() table = mocked_table() assert create_survey( survey=survey_instance, table=table ) == survey_instance
def test_create_response(dynamodb_table): from src.data.create_response import create_response response_instance = StubResponse() table = mocked_table() assert create_response( response=response_instance, table=table ) == response_instance
def setup_table_item(dynamodb_table): table = mocked_table() item = { 'PK': 'CUSTOMER#1', 'SK': 'PROFILE#1', 'customer_id': '1', 'profile_data': {'some': 'data'} } table.put_item(Item=item)
def test_create_response_returns_error_info_when_it_fails(dynamodb_table): from src.data.create_response import ( create_response, ResponseCreationException ) table = mocked_table() with pytest.raises(ResponseCreationException): create_response( response='Garbage', table=table )
def setup_table_item(dynamodb_table): table = mocked_table() item = { 'PK': 'CUSTOMER#1', 'SK': 'SURVEY#1', 'customer_id': '1', 'survey_id': '1', 'survey_data': { 'some': 'data' } } table.put_item(Item=item)
def test_get_customer(dynamodb_table): from src.data.get_customer import get_customer table = mocked_table() item = { 'PK': 'CUSTOMER#TEST_ID', 'SK': 'PROFILE#TEST_ID', 'customer_id': 'TEST_ID', 'profile_data': { 'some': 'data' } } table.put_item(Item=item) customer_instance = StubCustomer() assert get_customer(customer=customer_instance, table=table).to_item() == item
def test_get_survey(dynamodb_table): from src.data.get_survey import get_survey table = mocked_table() item = { 'PK': 'CUSTOMER#TEST_ID', 'SK': 'SURVEY#TEST_ID', 'customer_id': 'TEST_ID', 'survey_id': 'TEST_ID', 'survey_data': { 'some': 'data' } } table.put_item(Item=item) survey_instance = StubSurvey() assert get_survey(survey=survey_instance, table=table).to_item() == item
def test_get_response(dynamodb_table): from src.data.get_response import get_response table = mocked_table() item = { 'PK': 'SURVEY#TEST_ID', 'SK': 'RESPONSE#TEST_ID', 'survey_id': 'TEST_ID', 'response_id': 'TEST_ID', 'response_data': { 'some': 'data' } } table.put_item(Item=item) response_instance = StubResponse() assert get_response(response=response_instance, table=table).to_item() == item
def test_create_customer_returns_error_info_when_it_fails(dynamodb_table): from src.data.create_customer import (create_customer, CustomerCreationException) table = mocked_table() with pytest.raises(CustomerCreationException): create_customer(customer='Garbage', table=table)
def test_create_customer_returns_customer_instance(dynamodb_table): from src.data.create_customer import create_customer customer_instance = StubCustomer() table = mocked_table() assert create_customer(customer=customer_instance, table=table) == customer_instance