def test_get_forms_dtos_return_form_list(create_users, create_brands, create_items, create_sections, create_forms): # Arrange offset = 0 limit = 2 form_dto1 = FormDto(form_id=1, name="form1", description="form1", close_date=datetime.datetime(2020, 10, 10, 0, 0, 0), expected_delivery_date=datetime.datetime( 2020, 10, 10, 0, 0, 0), status="LIVE") form_dto2 = FormDto(form_id=2, name="form2", description="form2", close_date=datetime.datetime(2020, 10, 10, 0, 0, 0), expected_delivery_date=datetime.datetime( 2020, 10, 10, 0, 0, 0), status="CLOSED") expected_list = [form_dto1, form_dto2] storage = FormStorageImplementation() # Act actual_list = storage.get_forms_dtos(offset=offset, limit=limit) # Assert assert actual_list == expected_list
def _convert_form_obj_to_dto(self, form_obj) -> FormDto: return FormDto(form_id=form_obj.id, name=form_obj.name, description=form_obj.description, status=form_obj.status, close_date=form_obj.close_date, expected_delivery_date=form_obj.expected_delivery_date)
def get_form_dto(): form_dto = FormDto(form_id=1, name="FORM1", description="FORM1", status="LIVE", close_date=datetime.datetime(2020, 10, 10, 0, 0), expected_delivery_date=datetime.datetime( 2020, 10, 10, 0, 0)) return form_dto
def form_dtos(): form_dtos = [ FormDto(form_id=1, name="FORM1", description="FORM1", status="LIVE", close_date=datetime.datetime(2020, 10, 10, 0, 0), expected_delivery_date=datetime.datetime(2020, 10, 10, 0, 0)), FormDto(form_id=2, name="FORM2", description="FORM2", status="CLOSED", close_date=datetime.datetime(2020, 10, 10, 0, 0), expected_delivery_date=datetime.datetime(2020, 10, 10, 0, 0)), FormDto(form_id=3, name="FORM3", description="FORM3", status="LIVE", close_date=datetime.datetime(2020, 10, 10, 0, 0), expected_delivery_date=datetime.datetime(2020, 10, 10, 0, 0)) ] return form_dtos
def test_get_form_dto_return_form_dto(create_users, create_brands, create_items, create_sections, create_forms): # Arrange form_id = 1 expected_form_dto = FormDto( form_id=1, name="form1", description="form1", close_date=datetime.datetime(2020, 10, 10, 0, 0, 0), expected_delivery_date=datetime.datetime(2020, 10, 10, 0, 0, 0), status="LIVE" ) storage = FormStorageImplementation() # Act actual_form_dto = storage.get_form_dto(form_id=form_id) # Assert assert actual_form_dto == expected_form_dto