Skip to content

Commit

Permalink
fixup! Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaniszewska-dev committed Sep 25, 2023
1 parent 2cdc440 commit 226ea8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
37 changes: 2 additions & 35 deletions pingen/tests/test_pingen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
from vcr import VCR
from os.path import dirname, join
from odoo.tests import tagged
from odoo import Command
from ..controllers.main import PingenController
from odoo.tests.common import HttpCase
from unittest.mock import patch
from odoo.addons.website.tools import MockRequest

from freezegun import freeze_time

vcr_pingen = VCR(
record_mode='all',
Expand All @@ -33,44 +32,11 @@ class TestPingen(HttpCase):
def setUpClass(cls):
super().setUpClass()
cls.company = cls.env.user.company_id
cls.report_layout = cls.env.ref('web.report_layout_standard')
cls.company.external_report_layout_id = cls.report_layout.view_id.id,

cls.company.pingen_clientid = '1234'
cls.company.pingen_client_secretid = '1234567893'
cls.company.pingen_organization = '4c08c24e-65f8-47cf-b280-518ee76e3437'
cls.company.pingen_staging = True

### invoice record
cls.partner_a = cls.env["res.partner"].create({
'name':'Pingen Partner',
'street':'Blumenstrasse 100',
'zip':8134,
'city':'Adliswil',
'country_id': cls.env.ref('base.ch').id
})

uom_unit = cls.env.ref("uom.product_uom_unit")
cls.product_a = cls.env["product.product"].create({
"name": "product TEST",
"standard_price": 100.0,
#"type": "product",
"uom_id": uom_unit.id,
"default_code": "A",
})

cls.invoice = cls.env['account.move'].create([{
'move_type': 'out_invoice',
'partner_id': cls.partner_a.id,
'date': '2023-02-01',
'invoice_date': '2023-02-01',
'invoice_line_ids': [Command.create({
'product_id': cls.product_a.id,
'price_unit': 20.0,
})]
}])

cls.invoice.action_post()
cls.pc = PingenController()

def get_request_json(self,uuid):
Expand Down Expand Up @@ -192,6 +158,7 @@ def get_request_json(self,uuid):


@vcr_pingen.use_cassette
@freeze_time('2023-05-19')
def test_pingen_push_document(self):

session = self.company._get_pingen_client()
Expand Down
3 changes: 3 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vcr
requests_mock
freezegun

0 comments on commit 226ea8a

Please sign in to comment.