New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10.0] [FIX] connector_prestashop: Fix online tests (fresh Prestashop available) #108
[10.0] [FIX] connector_prestashop: Fix online tests (fresh Prestashop available) #108
Conversation
@pedrobaeza this is related to prestapyt/prestapyt#48 (comment) |
But why is a problem to let the other ID and so on? Tests environments are fresh each time the tests are performed. |
'id_product_attribute': '0', | ||
'id_shop': '1', | ||
'id_shop_group': '0', | ||
'out_of_stock': '2', | ||
'out_of_stock': '0', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAIL: test_job_export_qty (odoo.addons.connector_prestashop.tests.test_export_stock_qty_job.TestExportStockQuantity)
` Export a qty on PrestaShop
Traceback (most recent call last):
` File "connector_prestashop/tests/common.py", line 71, in _decorated
` result = func(self, *args, **kwargs)
` File "connector_prestashop/tests/test_export_stock_qty_job.py", line 69, in test_job_export_qty
` .issubset(set(body['prestashop']['stock_available'].items())))
` AssertionError: False is not true
If stock shortage default value is False instead of Default prestashop
variant_ps_id=1, | ||
name='Blouse', | ||
template_ps_id=2, | ||
variant_ps_id=7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAIL: test_import_inventory_record_template (odoo.addons.connector_prestashop.tests.test_import_inventory.TestImportInventory)
` Import the inventory for a template
Traceback (most recent call last):
` File "connector_prestashop/tests/common.py", line 71, in _decorated
` result = func(self, *args, **kwargs)
` File "connector_prestashop/tests/test_import_inventory.py", line 92, in test_import_inventory_record_template
` self.assertEqual(1799, template.qty_available)
` AssertionError: 1799 != 0.0
test_job_export_qty
executes first and test_import_inventory_record_template
later. They both use PS product 1. The export sets quantity to 0 and the import fails to assert expected quantity. We have modified test_job_export_qty
to use PS product 2 and avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
@@ -201,7 +201,7 @@ def test_import_partner_address_record(self): | |||
|
|||
expected = [ | |||
ExpectedAddress( | |||
name='John DOE (My address)', | |||
name='John DOE (Mon adresse)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAIL: test_import_partner_address_record (odoo.addons.connector_prestashop.tests.test_import_partner.TestImportPartner)
` Import a partner address
Traceback (most recent call last):
` File "connector_prestashop/tests/common.py", line 71, in _decorated
` result = func(self, *args, **kwargs)
` File "connector_prestashop/tests/test_import_partner.py", line 216, in test_import_partner_address_record
` self.assert_records(expected, address_bindings)
` File "connector_prestashop/tests/common.py", line 221, in assert_records
` '\n'.join(message)
` AssertionError: Records do not match:
`
` - prestashop.address(name: John DOE (My address), parent_id: res.partner(408,), street: 16, Main street, street2: 2nd floor, city: Paris, zip: 75002, country_id: res.country(76,), phone: 0102030405, mobile: False, type: other)
` + prestashop.address(name: John DOE (Mon adresse), parent_id: res.partner(408,), street: 16, Main street, street2: 2nd floor, city: Paris, zip: 75002, country_id: res.country(76,), phone: 0102030405, mobile: False, type: other)
In a fresh PS address 1 has Mon adresse as alias intead of My address.
@@ -88,7 +88,7 @@ def test_import_partner_batch(self): | |||
self.assertDictEqual(expected_query, self.parse_qs(request.uri)) | |||
|
|||
delay_record_instance = delay_record_mock.return_value | |||
self.assertEqual(5, delay_record_instance.import_record.call_count) | |||
self.assertEqual(4, delay_record_instance.import_record.call_count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAIL: test_import_partner_batch (odoo.addons.connector_prestashop.tests.test_import_partner.TestImportPartner)
Traceback (most recent call last):
` File "/home/paco/workspace/ptic-saas-server-10/eggs/freezegun-0.3.11-py2.7.egg/freezegun/api.py", line 658, in wrapper
` result = func(*args, **kwargs)
` File "connector_prestashop/tests/common.py", line 71, in _decorated
` result = func(self, *args, **kwargs)
` File "connector_prestashop/tests/test_import_partner.py", line 91, in test_import_partner_batch
` self.assertEqual(5, delay_record_instance.import_record.call_count)
` AssertionError: 5 != 4
In a fresh PS there are 3 groups + 1 customer instead of 2.
@@ -104,7 +104,7 @@ def test_import_partner_category_record(self): | |||
|
|||
expected = [ | |||
ExpectedCategory( | |||
name='Customer A', | |||
name='Customer', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAIL: test_import_partner_category_record (odoo.addons.connector_prestashop.tests.test_import_partner.TestImportPartner)
` Import a partner category
Traceback (most recent call last):
` File "connector_prestashop/tests/common.py", line 71, in _decorated
` result = func(self, *args, **kwargs)
` File "connector_prestashop/tests/test_import_partner.py", line 110, in test_import_partner_category_record
` self.assert_records(expected, category_bindings)
` File "connector_prestashop/tests/common.py", line 221, in assert_records
` '\n'.join(message)
` AssertionError: Records do not match:
`
` - prestashop.res.partner.category(name: Customer A)
` + prestashop.res.partner.category(name: Customer)
In a fresh PS customer group 3 is named Customer instead of Customer A.
I suppose all these change you are referring is in base of an specific PS version. On others it might be different. Any way, it's OK for me. I would prefer to have a real PS to tests against in Travis, but I know the difficulty of this, and more with multiple versions. |
'because it has not been paid since 30 days') | ||
self.assertEqual(result, error_msg) | ||
|
||
with freeze_time(order_date_29): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERROR: test_import_sale_record (odoo.addons.connector_prestashop.tests.test_import_sale.TestImportSale)
` Import a sale order
Traceback (most recent call last):
` File "connector_prestashop/tests/common.py", line 71, in _decorated
` result = func(self, *args, **kwargs)
` File "connector_prestashop/tests/test_import_sale.py", line 170, in test_import_sale_record
` self.backend_record, 5)
` File "connector_prestashop/models/binding/common.py", line 47, in import_record
` return importer.run(prestashop_id, force=force)
` File "connector_prestashop/components/importer.py", line 272, in run
` self._import(binding, **kwargs)
` File "connector_prestashop/components/importer.py", line 287, in _import
` record = self._create_data(map_record)
` File "connector_prestashop/components/importer.py", line 125, in _create_data
` return map_record.values(for_create=True)
` File "connector/components/mapper.py", line 979, in values
` values = self._mapper._apply(self, options=options)
` File "connector/components/mapper.py", line 753, in _apply
` return self._apply_with_options(map_record)
` File "connector/components/mapper.py", line 802, in _apply_with_options
` to_attr, model_name)
` File "connector_prestashop/models/sale_order/importer.py", line 194, in _map_child
` detail_record = adapter.read(child_record['id'])
` File "connector_prestashop/components/backend_adapter.py", line 197, in read
` res = self.client.get(self._prestashop_model, id, options=attributes)
` File "/home/paco/workspace/ptic-saas-server-10/eggs/prestapyt-0.9.0-py2.7.egg/prestapyt/prestapyt.py", line 393, in get
` return self.get_with_url(full_url)
` File "/home/paco/workspace/ptic-saas-server-10/eggs/prestapyt-0.9.0-py2.7.egg/prestapyt/prestapyt.py", line 566, in get_with_url
` response = super(PrestaShopWebServiceDict, self).get_with_url(url)
` File "/home/paco/workspace/ptic-saas-server-10/eggs/prestapyt-0.9.0-py2.7.egg/prestapyt/prestapyt.py", line 401, in get_with_url
` return self._parse(self._execute(url, 'GET').content)
` File "/home/paco/workspace/ptic-saas-server-10/eggs/prestapyt-0.9.0-py2.7.egg/prestapyt/prestapyt.py", line 241, in _execute
` headers=request_headers,
` File "/home/paco/workspace/ptic-saas-server-10/virtualenv/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
` resp = self.send(prep, **send_kwargs)
` File "/home/paco/workspace/ptic-saas-server-10/virtualenv/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
` r = adapter.send(request, **kwargs)
` File "/home/paco/workspace/ptic-saas-server-10/virtualenv/lib/python2.7/site-packages/requests/adapters.py", line 440, in send
` timeout=timeout
` File "/home/paco/workspace/ptic-saas-server-10/virtualenv/lib/python2.7/site-packages/urllib3/connectionpool.py", line 601, in urlopen
` chunked=chunked)
` File "/home/paco/workspace/ptic-saas-server-10/virtualenv/lib/python2.7/site-packages/urllib3/connectionpool.py", line 380, in _make_request
` httplib_response = conn.getresponse(buffering=True)
` File "/home/paco/workspace/ptic-saas-server-10/eggs/vcrpy-1.10.5-py2.7.egg/vcr/stubs/__init__.py", line 232, in getresponse
` self.cassette.record_mode)
` CannotOverwriteExistingCassetteException: No match for the request (<Request (GET) http://localhost:8080/api/order_details/13>) was found. Can't overwrite existing cassette ('connector_prestashop/tests/fixtures/cassettes/test_import_sale_record_5.yaml') in your current record mode ('once').
In a fresh PS orders are not older than 30 days. We have fixed this by querying the date of the order and freezing the time after and before 30 days from the date.
I have commented on the necessary changes to pass the failed tests. PS v1.6.1.23, the last v1.6 Thanks! |
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Hi,
connector_prestashop pass the tests with VCR recorded requests but not with new requests to a Prestashop available.
Here tests are fixed to pass them with a fresh Prestashop.
Regards!
cc @PlanetaTIC