[FIX] test from 01 to 04

This commit is contained in:
Sylvain LE GAL 2022-06-28 16:45:44 +02:00
parent 451be8c389
commit 4d3bb66e4e
6 changed files with 34 additions and 25 deletions

View File

@ -13,8 +13,8 @@ def test_cli_init():
"--log-level=DEBUG", "--log-level=DEBUG",
"init", "init",
"--project-name=test-cli", "--project-name=test-cli",
"--initial-version=13.0", "--initial-version=14.0",
"--final-version=14.0", "--final-version=15.0",
"--extra-repository=" "--extra-repository="
"OCA/web,OCA/server-tools,OCA/bank-statement-import", "OCA/web,OCA/server-tools,OCA/bank-statement-import",
] ]

View File

@ -12,14 +12,12 @@ def test_cli_get_code():
] ]
) )
# Check V13 # Check V14
openupgrade_path = Path("./src/env_13.0/src/openupgrade") web_path = Path("./src/env_14.0/src/OCA/web")
assert openupgrade_path.exists() assert web_path.exists()
assert (openupgrade_path / Path("odoo")).exists() # check V15
openupgrade_path = Path("./src/env_15.0/src/openupgrade")
# check V14
openupgrade_path = Path("./src/env_14.0/src/openupgrade")
assert openupgrade_path.exists() assert openupgrade_path.exists()

View File

@ -9,16 +9,16 @@ def test_cli_docker_build():
[ [
"--log-level=DEBUG", "--log-level=DEBUG",
"docker-build", "docker-build",
"--versions=13.0,14.0", "--versions=14.0,15.0",
] ]
) )
docker_client = get_docker_client() docker_client = get_docker_client()
assert docker_client.images.get( assert docker_client.images.get(
"odoo-openupgrade-wizard-image__test-cli__13.0" "odoo-openupgrade-wizard-image__test-cli__14.0"
) )
assert docker_client.images.get( assert docker_client.images.get(
"odoo-openupgrade-wizard-image__test-cli__14.0" "odoo-openupgrade-wizard-image__test-cli__15.0"
) )

View File

@ -1,7 +1,10 @@
from pathlib import Path from pathlib import Path
from odoo_openupgrade_wizard.tools.tools_docker import get_docker_client from odoo_openupgrade_wizard.tools.tools_docker import get_docker_client
from odoo_openupgrade_wizard.tools.tools_postgres import execute_sql_request from odoo_openupgrade_wizard.tools.tools_postgres import (
ensure_database,
execute_sql_request,
)
from . import ( from . import (
build_ctx_from_config_file, build_ctx_from_config_file,
@ -12,7 +15,11 @@ from . import (
def test_cli_run(): def test_cli_run():
move_to_test_folder() move_to_test_folder()
ctx = build_ctx_from_config_file()
db_name = "database_test_cli___run" db_name = "database_test_cli___run"
ensure_database(ctx, db_name, state="absent")
cli_runner_invoke( cli_runner_invoke(
[ [
"--log-level=DEBUG", "--log-level=DEBUG",
@ -29,7 +36,6 @@ def test_cli_run():
assert db_filestore_path.exists() assert db_filestore_path.exists()
# Ensure that 'base' module is installed # Ensure that 'base' module is installed
ctx = build_ctx_from_config_file()
request = ( request = (
"SELECT id" "SELECT id"
" FROM ir_module_module" " FROM ir_module_module"

View File

@ -2,7 +2,10 @@ from pathlib import Path
from plumbum.cmd import cp from plumbum.cmd import cp
from odoo_openupgrade_wizard.tools.tools_postgres import execute_sql_request from odoo_openupgrade_wizard.tools.tools_postgres import (
ensure_database,
execute_sql_request,
)
from . import ( from . import (
build_ctx_from_config_file, build_ctx_from_config_file,
@ -13,6 +16,8 @@ from . import (
def test_cli_execute_script_python(): def test_cli_execute_script_python():
move_to_test_folder() move_to_test_folder()
ctx = build_ctx_from_config_file()
extra_script_path = Path("../extra_script/click_odoo_test.py").absolute() extra_script_path = Path("../extra_script/click_odoo_test.py").absolute()
cp( cp(
extra_script_path, extra_script_path,
@ -20,6 +25,7 @@ def test_cli_execute_script_python():
) )
db_name = "database_test_cli___execute_script_python" db_name = "database_test_cli___execute_script_python"
ensure_database(ctx, db_name, state="absent")
# Install Odoo on V13 with base installed # Install Odoo on V13 with base installed
cli_runner_invoke( cli_runner_invoke(
@ -34,7 +40,6 @@ def test_cli_execute_script_python():
) )
# Compute partners quantity # Compute partners quantity
ctx = build_ctx_from_config_file()
request = "SELECT count(*)" " FROM res_partner;" request = "SELECT count(*)" " FROM res_partner;"
partner_quantity_before = int( partner_quantity_before = int(
execute_sql_request(ctx, request, database=db_name)[0][0] execute_sql_request(ctx, request, database=db_name)[0][0]

View File

@ -8,32 +8,32 @@ odoo_default_country_code: FR
odoo_versions: odoo_versions:
- 13.0
- 14.0 - 14.0
- 15.0
odoo_version_settings: odoo_version_settings:
13.0:
repo_url: False
14.0: 14.0:
repo_url: False repo_url: False
15.0:
repo_url: False
migration_steps: migration_steps:
- name: 1 - name: 1
version: 13.0 version: 14.0
execution_context: regular execution_context: regular
complete_name: step_01__update__13.0 complete_name: step_01__update__14.0
- name: 2 - name: 2
version: 14.0 version: 15.0
execution_context: openupgrade execution_context: openupgrade
complete_name: step_02__upgrade__14.0 complete_name: step_02__upgrade__15.0
- name: 3 - name: 3
version: 14.0 version: 15.0
execution_context: regular execution_context: regular
complete_name: step_03__update__14.0 complete_name: step_03__update__15.0
workload_settings: workload_settings: