Skip to content
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

[16.0][MIG] test_base_import_async: Migrate to version 16.0 #1

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ exclude: |
(?x)
# NOT INSTALLABLE ADDONS
^test_base_import_async/|
^base_export_async/|
^queue_job_subscribe/|
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
Expand Down
6 changes: 6 additions & 0 deletions setup/test_base_import_async/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
22 changes: 15 additions & 7 deletions test_base_import_async/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Test suite for base_import_async
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github
:target: https://github.com/OCA/queue/tree/14.0/test_base_import_async
:target: https://github.com/OCA/queue/tree/16.0/test_base_import_async
:alt: OCA/queue
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-test_base_import_async
:target: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-test_base_import_async
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/230/14.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/queue&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Expand All @@ -38,7 +38,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/queue/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20test_base_import_async%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/queue/issues/new?body=module:%20test_base_import_async%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -56,6 +56,14 @@ Contributors
* Stéphane Bidoul (ACSONE)
* Dennis Sluijk (Onestein)
* Guewen Baconnier (Camptocamp)
* `Trobz <https://trobz.com>`_:

* Son Ho <[email protected]>

Other credits
~~~~~~~~~~~~~

The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp

Maintainers
~~~~~~~~~~~
Expand All @@ -70,6 +78,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/14.0/test_base_import_async>`_ project on GitHub.
This module is part of the `OCA/queue <https://github.com/OCA/queue/tree/16.0/test_base_import_async>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions test_base_import_async/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Test suite for base_import_async",
"version": "14.0.1.0.1",
"version": "16.0.1.0.0",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/queue",
Expand All @@ -15,6 +15,6 @@
""",
"depends": ["base_import_async", "account"],
"data": [],
"installable": False,
"installable": True,
"development_status": "Production/Stable",
}
3 changes: 3 additions & 0 deletions test_base_import_async/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* Stéphane Bidoul (ACSONE)
* Dennis Sluijk (Onestein)
* Guewen Baconnier (Camptocamp)
* `Trobz <https://trobz.com>`_:

* Son Ho <[email protected]>
1 change: 1 addition & 0 deletions test_base_import_async/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp
33 changes: 24 additions & 9 deletions test_base_import_async/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Test suite for base_import_async</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Test suite for base_import_async</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/queue/tree/14.0/test_base_import_async"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/queue-14-0/queue-14-0-test_base_import_async"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/230/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/queue/tree/16.0/test_base_import_async"><img alt="OCA/queue" src="https://img.shields.io/badge/github-OCA%2Fqueue-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-test_base_import_async"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/queue&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Test suite for base_import_async. Normally you don’t need to install this.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand All @@ -376,7 +376,8 @@ <h1 class="title">Test suite for base_import_async</h1>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="id5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -386,7 +387,7 @@ <h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/queue/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/queue/issues/new?body=module:%20test_base_import_async%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/queue/issues/new?body=module:%20test_base_import_async%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -399,20 +400,34 @@ <h2><a class="toc-backref" href="#id3">Authors</a></h2>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul>
<li><p class="first">Stéphane Bidoul (ACSONE)</p>
</li>
<li><p class="first">Dennis Sluijk (Onestein)</p>
</li>
<li><p class="first">Guewen Baconnier (Camptocamp)</p>
</li>
<li><p class="first"><a class="reference external" href="https://trobz.com">Trobz</a>:</p>
<blockquote>
<ul class="simple">
<li>Stéphane Bidoul (ACSONE)</li>
<li>Dennis Sluijk (Onestein)</li>
<li>Guewen Baconnier (Camptocamp)</li>
<li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li>
</ul>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id5">Other credits</a></h2>
<p>The migration of this module from 14.0 to 16.0 was financially supported by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/queue/tree/14.0/test_base_import_async">OCA/queue</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/queue/tree/16.0/test_base_import_async">OCA/queue</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion test_base_import_async/tests/account.move.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
date,journal_id/id,name,ref,line_ids/account_id/id,line_ids/name,line_ids/debit,line_ids/credit,line_ids/partner_id/id
2014-11-08,test_base_import_async.testjournal_xmlid,TEST-1,SAJ/2014/005,test_base_import_async.a_recv_xmlid,/,525,,base.res_partner_3
,,,,test_base_import_async.a_sale_xmlid,Ergonomic Mouse,,75,base.res_partner_3
,,,,test_base_import_async.a_sale_xmlid,TypeMatrix Dvorak Keyboard,,450,base.res_partner_3
Expand Down
12 changes: 6 additions & 6 deletions test_base_import_async/tests/test_base_import_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from odoo.addons.queue_job.job import Job


class TestBaseImportAsync(common.SavepointCase):
class TestBaseImportAsync(common.TransactionCase):

FIELDS = [
"date",
Expand Down Expand Up @@ -79,7 +79,7 @@ def _do_import(self, file_name, use_queue, chunk_size=None):
options = dict(self.OPTIONS)
options[OPT_USE_QUEUE] = use_queue
options[OPT_CHUNK_SIZE] = chunk_size
return importer.do(self.FIELDS, self.FIELDS, options)
return importer.execute_import(self.FIELDS, self.FIELDS, options)

def _check_import_result(self):
move_count = self.move_obj.search_count(
Expand All @@ -88,13 +88,13 @@ def _check_import_result(self):
self.assertEqual(move_count, 3)

def test_normal_import(self):
""" Test the standard import still works. """
"""Test the standard import still works."""
res = self._do_import("account.move.csv", use_queue=False)
self.assertFalse(res["messages"], repr(res))
self._check_import_result()

def test_async_import(self):
""" Basic asynchronous import test with default large chunk size. """
"""Basic asynchronous import test with default large chunk size."""
res = self._do_import("account.move.csv", use_queue=True)
self.assertFalse(res, repr(res))
# no moves should be created yet
Expand Down Expand Up @@ -123,7 +123,7 @@ def test_async_import(self):
self._check_import_result()

def test_async_import_small_misaligned_chunks(self):
""" Chunk size larger than record. """
"""Chunk size larger than record."""
res = self._do_import("account.move.csv", use_queue=True, chunk_size=4)
self.assertFalse(res, repr(res))
# but we must have one job to split the file
Expand All @@ -148,7 +148,7 @@ def test_async_import_small_misaligned_chunks(self):
self._check_import_result()

def test_async_import_smaller_misaligned_chunks(self):
""" Chunk size smaller than record. """
"""Chunk size smaller than record."""
res = self._do_import("account.move.csv", use_queue=True, chunk_size=2)
self.assertFalse(res, repr(res))
# but we must have one job to split the file
Expand Down
Loading