def test_parse_if_receipt_found(self):
        result = Parser().parse(
            get_file_content('platforma_ofd_receipt_found.html'))

        assert result.fiscal_drive_number == '8710000100688395'
        assert result.fiscal_document_number == '29324'
        assert result.fiscal_sign == '2745981095'
        assert result.seller_name == 'ООО "Спар-Томск"'
        assert result.seller_individual_number == '7017326645'
        assert result.created == datetime(2017, 7, 29, 18, 19)

        assert len(result.items) == 5

        assert result.items[0].name == 'Мороженое Пломбир на йогурте к'
        assert result.items[0].quantity == Decimal(3)
        assert result.items[0].price == Decimal('43.6')
        assert result.items[0].total == Decimal('130.8')

        assert result.items[2].name == 'Квас ЖИТНИЦА 1,5л Деревенский'
        assert result.items[2].quantity == Decimal(1)
        assert result.items[2].price == Decimal('75.8')
        assert result.items[2].total == Decimal('75.8')

        assert result.items[4].name == 'Сухарики Не только Для своих Б'
        assert result.items[4].quantity == Decimal(1)
        assert result.items[4].price == Decimal('30.7')
        assert result.items[4].total == Decimal('30.7')
Exemple #2
0
    def test_parse_if_receipt_found_v2(self):
        result = Parser().parse(
            get_file_content('taxcom_receipt_found_v2.html'))

        assert result.fiscal_drive_number == '8710000100548077'
        assert result.fiscal_document_number == '43119'
        assert result.fiscal_sign == '1514696382'
        assert result.seller_name == 'ООО "Лента"'
        assert result.seller_individual_number == '7814148471'
        assert result.created == datetime(2017, 10, 21, 12, 25)

        assert len(result.items) == 14

        assert result.items[
            0].name == 'Продукт к/м ДЕРЕВ МОЛ яб/б 2,5% п/п 450г'
        assert result.items[0].quantity == Decimal(1)
        assert result.items[0].price == Decimal('40.89')
        assert result.items[0].total == Decimal('40.89')

        assert result.items[5].name == 'Орехи грецкие очищ. 1 сорт вес'
        assert result.items[5].quantity == Decimal('0.191')
        assert result.items[5].price == Decimal('997.06')
        assert result.items[5].total == Decimal('190.44')

        assert result.items[
            13].name == 'Т/бумага FAMILIA Plus Маг цвет 2-сл.12шт'
        assert result.items[13].quantity == Decimal(1)
        assert result.items[13].price == Decimal('119.99')
        assert result.items[13].total == Decimal('119.99')
Exemple #3
0
    def test_parse_if_receipt_found_v1(self):
        result = Parser().parse(
            get_file_content('taxcom_receipt_found_v1.html'))

        assert result.fiscal_drive_number == '8710000100547729'
        assert result.fiscal_document_number == '55102'
        assert result.fiscal_sign == '3848832309'
        assert result.seller_name == 'ООО "Лента"'
        assert result.seller_individual_number == '7814148471'
        assert result.created == datetime(2017, 8, 6, 13, 8)

        assert len(result.items) == 13

        assert result.items[0].name == 'Пакет ЛЕНТА майка 9кг'
        assert result.items[0].quantity == Decimal(1)
        assert result.items[0].price == Decimal('3.19')
        assert result.items[0].total == Decimal('3.19')

        assert result.items[
            7].name == "Мыло DURU Nature'S Treasures Мед Минд90г"
        assert result.items[7].quantity == Decimal(1)
        assert result.items[7].price == Decimal('26.59')
        assert result.items[7].total == Decimal('26.59')

        assert result.items[12].name == 'Томаты вес 1 кг'
        assert result.items[12].quantity == Decimal('0.316')
        assert result.items[12].price == Decimal('56.89')
        assert result.items[12].total == Decimal('17.98')
    def test_parse_if_receipt_found_with_no_barcodes_v2(self):
        result = Parser().parse(
            get_file_content(
                'platforma_ofd_receipt_found_with_no_barcodes_v2.html'))

        assert result.fiscal_drive_number == '9288000100020178'
        assert result.fiscal_document_number == '124028'
        assert result.fiscal_sign == '2664983421'
        assert result.seller_name == 'ООО "Спар-Томск"'
        assert result.seller_individual_number == '7017326645'
        assert result.created == datetime(2019, 4, 6, 20, 40)

        assert len(result.items) == 7

        assert result.items[
            0].name == 'Молоко Деревенское молочко 3,2% 900г п/п'
        assert result.items[0].quantity == Decimal(1)
        assert result.items[0].price == Decimal('39.9')
        assert result.items[0].total == Decimal('39.9')
    def test_parse_if_receipt_found_with_no_barcodes(self):
        result = Parser().parse(
            get_file_content(
                'platforma_ofd_receipt_found_with_no_barcodes.html'))

        assert result.fiscal_drive_number == '8710000100816354'
        assert result.fiscal_document_number == '1539'
        assert result.fiscal_sign == '2964112708'
        assert result.seller_name == 'ООО "Хитэк-Сибирь"'
        assert result.seller_individual_number == '5406358004'
        assert result.created == datetime(2017, 6, 30, 19, 32)

        assert len(result.items) == 1

        assert result.items[
            0].name == '1. KAP-590  Флюид для поврежденных кончиков волос "Treatment", 6'
        assert result.items[0].quantity == Decimal(1)
        assert result.items[0].price == Decimal(279)
        assert result.items[0].total == Decimal(279)
Exemple #6
0
def good_response(mocker):
    response = mocker.MagicMock()
    response.status_code = HTTPStatus.OK
    response.json.return_value = json.loads(
        get_file_content('nalog_ru_receipt_found.json'))
    return response
 def test_parse_if_receipt_not_found(self):
     result = Parser().parse(
         get_file_content('platforma_ofd_receipt_not_found.html'))
     assert result is None