def test_correct_all_types(self, balancer_api, sno, company_inn,
                            payment_address, group_code, operation: str,
                            check_receipt_state, correction_type: str,
                            correction_type_description: str):
     attach_to_allure(data=correction_type_description,
                      name='Описание типа коррекции')
     with step(1, 'Генерация чека'):
         receipt = DefaultReceiptCorrectionMinFields(
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         receipt.correction.correction_info = ReceiptBase.Correction.CorrectionInfo(
             type_=correction_type,
             base_date=Defaults.today_date,
             base_number=Defaults.Correction.base_number,
         )
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
Ejemplo n.º 2
0
 def test_correct_all_types(self, balancer_api, sno, company_inn,
                            payment_address, group_code,
                            check_receipt_state, operation: str,
                            mark_type: str, mark_value: Union[int, str]):
     """
     Тест проверяет регистрацию чека с корректным значением поля {receipt|correction}.items.{item}.mark_code
     (всех возможных типов)
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         mark_code = ReceiptBase.Item.MarkCode(**{mark_type: mark_value})
         receipt._main.items[0].mark_code = mark_code
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
Ejemplo n.º 3
0
 def test_correct_all_payment_methods(self, balancer_api, sno, company_inn,
                                      payment_address, group_code,
                                      check_receipt_state, operation: str,
                                      payment_method: str,
                                      payment_method_name: str):
     """
     Тест проверяет регистрацию чека со всеми допустимыми значениями поля
     {receipt|correction}.items.{item}.payment_method
     """
     attach_to_allure(data=payment_method_name,
                      name='Описание payment_method')
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         item = receipt._main.items[0]
         item.payment_method = payment_method
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
Ejemplo n.º 4
0
 def test_without_agent_info(self, balancer_api, sno, company_inn,
                             payment_address, group_code,
                             check_receipt_state, operation: str):
     """
     Тест проверяет регистрацию чека без указания поля {receipt|correction}.items.{item}.agent_info, но с указанием
     поля {receipt|correction}.items.{item}.supplier_info
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         item = receipt._main.items[0]
         item.supplier_info = default_supplier_info()
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
 def test_correct(self, balancer_api, sno, company_inn, payment_address, group_code, check_receipt_state,
                  operation: str, vat_type: str, nds: int):
     """
     Тест проверяет регистрацию чека с корректным значением поля {receipt|correction}.vats
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         nds_sum = get_nds_sum(Defaults.Item.price * Defaults.Item.quantity, nds)
         item_price = Defaults.Item.price + nds_sum
         item = ReceiptBase.Item(vat=ReceiptBase.Vat(type_=vat_type), price=item_price,
                                 sum_=item_price * Defaults.Item.quantity,
                                 quantity=Defaults.Item.quantity, name=Defaults.Item.name,
                                 measure=Defaults.Item.measure, payment_method=Defaults.Item.payment_method,
                                 payment_object=Defaults.Item.payment_object)
         receipt._main.items = [item]
         receipt._main.vats = [ReceiptBase.Vat(type_=vat_type, sum_=nds_sum)]
         total = sum((item.sum for item in receipt._main.items))
         receipt._main.payments = [ReceiptBase.Payment(type_=Defaults.Payment.type, sum_=total)]
         receipt._main.total = total
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
 def test_correct(self, balancer_api, sno, company_inn, payment_address, group_code, check_receipt_state,
                  operation: str, item_quantity: Union[int, float, Any]):
     """
     Тест проверяет регистрацию чека с корректным значением поля {receipt|correction}.items.{item}.quantity
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         item = receipt._main.items[0]
         item.quantity = item_quantity
         if isinstance(item_quantity, (int, float)):
             item.sum = item.price * item.quantity
             receipt._main.payments[0].sum = item.sum
             receipt._main.total = item.sum
             if isinstance(item_quantity, float):
                 item.measure = 10
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
 def test_item_quantity_with_mark_quantity_incorrect(self, balancer_api, sno, company_inn, payment_address,
                                                     group_code, operation: str, item_quantity: Any):
     """
     Тест проверяет регистрацию чека при одновременном указании полей {receipt|correction}.items.{item}.quantity и
     {receipt|correction}.items.{item}.mark_quantity с некорректым значением
     {receipt|correction}.items.{item}.quantity (!=1)
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         item = receipt._main.items[0]
         item.mark_quantity = ReceiptBase.Item.MarkQuantity(numerator=2, denominator=1)
         item.mark_code = ReceiptBase.Item.MarkCode(unknown='test')
         item.quantity = item_quantity
         if isinstance(item_quantity, (int, float)):
             if item_quantity > 0:
                 item.sum = item.price * item.quantity
                 receipt._main.payments[0].sum = item.sum
                 receipt._main.total = item.sum
                 if isinstance(item_quantity, float):
                     item.measure = 10
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 8
0
 def test_all_federal_ids(self, balancer_api, sno, company_inn,
                          payment_address, group_code, check_receipt_state,
                          operation: str, federal_id: str,
                          federal_id_name: str):
     """
     Тест проверяет регистрацию чека со всеми допустимыми значениями поля
     {receipt|correction}.items.{item}.sectorial_item_props.federal_id
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         item = receipt._main.items[0]
         sectorial_item_props = ReceiptBase.Item.SectorialItemProps(
             federal_id=federal_id,
             date=Defaults.today_date,
             number=Defaults.Item.SectorialItemProps.number,
             value=Defaults.Item.SectorialItemProps.value,
         )
         item.sectorial_item_props = [sectorial_item_props]
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
Ejemplo n.º 9
0
 def test_wrong_vat_sum(self, balancer_api, sno, company_inn,
                        payment_address, group_code, operation: str,
                        vat_type: Any, nds: Any):
     """
     Тест проверяет регистрацию чека с некорректным значением поля {receipt|correction}.items.{item}.vat.sum
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         item = receipt._main.items[0]
         nds_sum = get_nds_sum(item.price, nds)
         item.price = item.price + nds_sum
         item.sum = item.price * item.quantity
         vat = ReceiptBase.Vat(type_=vat_type,
                               sum_=(nds_sum * item.quantity) + 1)
         item.vat = vat
         receipt._main.payments[0].sum = item.sum
         receipt._main.total = item.sum
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 10
0
 def test_correct_with_sum(self, balancer_api, sno, company_inn,
                           payment_address, group_code, check_receipt_state,
                           operation: str, vat_type: str,
                           nds: Union[int, float]):
     """
     Тест проверяет регистрацию чека с корректным значением поля {receipt|correction}.items.{item}.vat
     с указанием поля {receipt|correction}.items.{item}.vat.sum
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         item = receipt._main.items[0]
         nds_sum = get_nds_sum(item.price, nds)
         item.price = item.price + nds_sum
         item.sum = item.price * item.quantity
         vat = ReceiptBase.Vat(type_=vat_type, sum_=nds_sum * item.quantity)
         item.vat = vat
         receipt._main.payments[0].sum = item.sum
         receipt._main.total = item.sum
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
Ejemplo n.º 11
0
 def test_correct(self, balancer_api, sno, company_inn, payment_address,
                  group_code, check_receipt_state, operation: str,
                  numerator: Union[int, float], denominator: Union[int,
                                                                   float]):
     """
     Тест проверяет регистрацию чека с корректным значением поля {receipt|correction}.items.{item}.mark_quantity
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         mark_code = ReceiptBase.Item.MarkCode(unknown='test')
         mark_quantity = ReceiptBase.Item.MarkQuantity(
             numerator=numerator, denominator=denominator)
         receipt._main.items[0].mark_code = mark_code
         receipt._main.items[0].mark_quantity = mark_quantity
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(
                 receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
 def test_max_vats_count_both_sum(self, balancer_api, sno, company_inn, payment_address, group_code,
                                  check_receipt_state, operation: str):
     """
     Тест проверяет регистрацию чека с максимально допустимым количеством элементов в поле {receipt|correction}.vats
     с одновременным указанием полей {receipt|correction}.vats.{vat}.sum и {receipt|correction}.items.{item}.vat.sum
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.items = []
         receipt._main.vats = []
         for index, (vat_type, nds) in enumerate(Defaults.vat_types_dict.items()):
             nds_sum = get_nds_sum(Defaults.Item.price * Defaults.Item.quantity, nds)
             item_price = Defaults.Item.price + nds_sum
             vat = ReceiptBase.Vat(type_=vat_type, sum_=nds_sum)
             item = ReceiptBase.Item(vat=vat, price=item_price,
                                     sum_=item_price * Defaults.Item.quantity,
                                     quantity=Defaults.Item.quantity, name=Defaults.Item.name,
                                     measure=Defaults.Item.measure, payment_method=Defaults.Item.payment_method,
                                     payment_object=Defaults.Item.payment_object)
             receipt._main.items.append(item)
             receipt._main.vats.append(vat)
         total = sum((item.sum for item in receipt._main.items))
         receipt._main.payments = [ReceiptBase.Payment(type_=Defaults.Payment.type, sum_=total)]
         receipt._main.total = total
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
Ejemplo n.º 13
0
 def test_name_over_length(self, balancer_api, sno, company_inn, payment_address, group_code, check_receipt_state,
                           operation: str):
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.additional_user_props = ReceiptBase.AdditionalUserProps(name='t' * 65, value='test')
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
 def test_without_company_inn(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str):
     """
     Тест проверяет регистрацию чека без указания поля {receipt|correction}.company.inn
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.company.inn = ...
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
 def test_company_sno_wrong_value(self, balancer_api, company_inn, payment_address, group_code, operation: str,
                                  company_sno: str):
     """
     Тест проверяет регистрацию чека с некорректным значением поля {receipt|correction}.company.sno
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=company_sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 16
0
 def test_wrong_total_format(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str,
                             total):
     """
     Тест проверяет регистрацию чека с неверным форматом значения поля {receipt|correction}.total
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.total = total
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 17
0
 def test_without_value(self, balancer_api, sno, company_inn, payment_address, group_code, check_receipt_state,
                        operation: str):
     """
     Тест проверяет регистрацию чека при отсутствии поля {receipt|correction}.additional_user_props.value
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.additional_user_props = ReceiptBase.AdditionalUserProps(name='test')
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 18
0
 def test_value_over_length(self, balancer_api, sno, company_inn, payment_address, group_code, check_receipt_state,
                            operation: str):
     """
     Тест проверяет регистрацию чека с длиной значения поля {receipt|correction}.additional_user_props.value
     первышающей максимально допустимую
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.additional_user_props = ReceiptBase.AdditionalUserProps(name='test', value='t' * 257)
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 19
0
 def test_payments_over_max_count(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str):
     """
     Тест проверяет регистрацию чека с количеством элементов в поле {receipt|correction}.payments
     превышающим максимально допустимое
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         payment = ReceiptBase.Payment(type_=1, sum_=receipt._main.total / 20)
         receipt._main.payments = [payment] * 20
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 20
0
 def test_wrong_payment_type(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str,
                             payment_type):
     """
     Тест проверяет регистрацию чека с некорректным значением поля {receipt|correction}.payments.{payment}.type
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         payment = ReceiptBase.Payment(type_=payment_type, sum_=receipt._main.total)
         receipt._main.payments = [payment]
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
 def test_company_payment_address_over_length(self, balancer_api, sno, company_inn, payment_address, group_code,
                                              operation: str):
     """
     Тест проверяет регистрацию чека с длиной значения поля {receipt|correction}.company.payment_address
     превышающей максимально допустимую
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         receipt._main.company.payment_address = 't' * 257
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
 def test_agent_info_without_type(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str):
     """
     Тест проверяет регистрацию чека без указания поля {receipt|correction}.items.{item}.agent_info.type
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         agent_info = default_agent_info()
         agent_info.type = ...
         item = receipt._main.items[0]
         item.agent_info = agent_info
         item.supplier_info = default_supplier_info()
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
 def test_company_sno_correct(self, balancer_api, company_inn, payment_address, group_code, check_receipt_state,
                              operation: str, company_sno: str):
     """
     Тест проверяет регистрацию чека с корректным значением поля {receipt|correction}.company.sno
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=company_sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_success(response)
         receipt_uuid = response.json()['uuid']
     if check_receipt_state:
         with step(3, 'Получение нового статуса чека'):
             new_receipt_status, response = get_receipt_new_status(receipt_uuid, balancer_api, group_code)
             assert_receipt_state_done(response)
 def test_address_over_length(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str):
     """
     Тест проверяет регистрацию чека с длиной значения поля
     {receipt|correction}.items.{item}.agent_info.receive_payments_operator.address превышающей максимально допустимую
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         agent_info = default_agent_info()
         agent_info.money_transfer_operator.address = 't' * 257
         item = receipt._main.items[0]
         item.agent_info = agent_info
         item.supplier_info = default_supplier_info()
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
Ejemplo n.º 25
0
 def test_wrong_format(self, balancer_api, sno, company_inn,
                       payment_address, group_code, operation: str,
                       callback_url: str):
     """
     Тест проверяет регистрацию чека с неверным форматом значения поля service.callback_url
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         receipt.service = ReceiptBase.Service(callback_url=callback_url)
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_error(response)
 def test_wrong_value(self, balancer_api, sno, company_inn, payment_address,
                      group_code, operation: str, excise: Union[int,
                                                                float]):
     """
     Тест проверяет регистрацию чека с некорректным значением поля {receipt|correction}.items.{item}.excise
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         receipt._main.items[0].excise = excise
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_error(response)
 def test_wrong_correction_type(self, balancer_api, sno, company_inn,
                                payment_address, group_code, operation: str,
                                correction_type: Any):
     with step(1, 'Генерация чека'):
         receipt = DefaultReceiptCorrectionMinFields(
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         receipt.correction.correction_info = ReceiptBase.Correction.CorrectionInfo(
             type_=correction_type,
             base_date=Defaults.today_date,
             base_number=Defaults.Correction.base_number,
         )
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_error(response)
 def test_mark_processing_mode_is_int(self, balancer_api, sno, company_inn,
                                      payment_address, group_code,
                                      operation: str):
     """
     Тест проверяет регистрацию чека с типом поля
     {receipt|correction}.items.{item}.mark_processing_mode - int
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         receipt._main.items[0].mark_processing_mode = 0
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_error(response)
 def test_wrong_inn(self, balancer_api, sno, company_inn, payment_address, group_code, operation: str,
                    money_transfer_operator_inn: str):
     """
     Тест проверяет регистрацию чека с некорректным значением поля
     {receipt|correction}.items.{item}.agent_info.receive_payments_operator.inn
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](sno=sno, company_inn=company_inn,
                                                     payment_address=payment_address)
         agent_info = default_agent_info()
         agent_info.money_transfer_operator.inn = money_transfer_operator_inn
         item = receipt._main.items[0]
         item.agent_info = agent_info
         item.supplier_info = default_supplier_info()
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code, operation)
         assert_receipt_sending_error(response)
 def test_without_timestamp(self, balancer_api, sno, company_inn,
                            payment_address, group_code, operation: str):
     """
     Тест проверяет регистрацию чека без указания поля {receipt|correction}.operating_check_props.timestamp
     """
     with step(1, 'Генерация чека'):
         receipt = ReceiptBaseByOperation[operation](
             sno=sno,
             company_inn=company_inn,
             payment_address=payment_address)
         operating_check_props = ReceiptBase.OperatingCheckProps(
             name='0', value='test')
         receipt._main.operating_check_props = operating_check_props
         attach_receipt_to_allure(receipt)
     with step(2, 'Отправка запроса на регистрацию'):
         response = balancer_api.send_receipt(receipt, group_code,
                                              operation)
         assert_receipt_sending_error(response)