various
This commit is contained in:
parent
9f5dea8a00
commit
842e2ca389
|
|
@ -28,7 +28,7 @@ def move_to_test_folder():
|
||||||
os.chdir(test_folder_path)
|
os.chdir(test_folder_path)
|
||||||
|
|
||||||
|
|
||||||
def cli_runner_invoke(ctx, cmd):
|
def cli_runner_invoke(cmd):
|
||||||
try:
|
try:
|
||||||
result = CliRunner().invoke(
|
result = CliRunner().invoke(
|
||||||
main,
|
main,
|
||||||
|
|
@ -42,8 +42,8 @@ def cli_runner_invoke(ctx, cmd):
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
|
|
||||||
log_files = [
|
log_files = [
|
||||||
ctx.obj["log_folder_path"] / Path(f)
|
Path("log") / Path(f)
|
||||||
for f in os.listdir(ctx.obj["log_folder_path"])
|
for f in os.listdir(Path("log"))
|
||||||
if f[-4:] == ".log"
|
if f[-4:] == ".log"
|
||||||
]
|
]
|
||||||
for log_file in log_files:
|
for log_file in log_files:
|
||||||
|
|
@ -77,5 +77,4 @@ def build_ctx_from_config_file() -> dict:
|
||||||
|
|
||||||
ctx.obj["env_folder_path"] = env_folder_path
|
ctx.obj["env_folder_path"] = env_folder_path
|
||||||
ctx.obj["src_folder_path"] = env_folder_path / Path("src")
|
ctx.obj["src_folder_path"] = env_folder_path / Path("src")
|
||||||
ctx.obj["log_folder_path"] = env_folder_path / Path("log")
|
|
||||||
return ctx
|
return ctx
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,15 @@
|
||||||
import filecmp
|
import filecmp
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from . import (
|
from . import cli_runner_invoke, move_to_test_folder
|
||||||
build_ctx_from_config_file,
|
|
||||||
cli_runner_invoke,
|
|
||||||
move_to_test_folder,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_init():
|
def test_cli_init():
|
||||||
move_to_test_folder()
|
move_to_test_folder()
|
||||||
ctx = build_ctx_from_config_file()
|
|
||||||
|
|
||||||
expected_folder_path = Path("../output_expected").absolute()
|
expected_folder_path = Path("../output_expected").absolute()
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"init",
|
"init",
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,12 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from . import (
|
from . import cli_runner_invoke, move_to_test_folder
|
||||||
build_ctx_from_config_file,
|
|
||||||
cli_runner_invoke,
|
|
||||||
move_to_test_folder,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_get_code():
|
def test_cli_get_code():
|
||||||
move_to_test_folder()
|
move_to_test_folder()
|
||||||
ctx = build_ctx_from_config_file()
|
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"get-code",
|
"get-code",
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,12 @@
|
||||||
from odoo_openupgrade_wizard.tools.tools_docker import get_docker_client
|
from odoo_openupgrade_wizard.tools.tools_docker import get_docker_client
|
||||||
|
|
||||||
from . import (
|
from . import cli_runner_invoke, move_to_test_folder
|
||||||
build_ctx_from_config_file,
|
|
||||||
cli_runner_invoke,
|
|
||||||
move_to_test_folder,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_docker_build():
|
def test_cli_docker_build():
|
||||||
move_to_test_folder()
|
move_to_test_folder()
|
||||||
ctx = build_ctx_from_config_file()
|
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"docker-build",
|
"docker-build",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ def test_cli_run():
|
||||||
ensure_database(ctx, db_name, state="absent")
|
ensure_database(ctx, db_name, state="absent")
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"run",
|
"run",
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ def test_cli_execute_script_python():
|
||||||
|
|
||||||
# Install Odoo on V14 with base installed
|
# Install Odoo on V14 with base installed
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"run",
|
"run",
|
||||||
|
|
@ -50,7 +49,6 @@ def test_cli_execute_script_python():
|
||||||
|
|
||||||
# Execute Custom Python Script
|
# Execute Custom Python Script
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"execute-script-python",
|
"execute-script-python",
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ from . import (
|
||||||
|
|
||||||
def test_cli_execute_script_sql():
|
def test_cli_execute_script_sql():
|
||||||
move_to_test_folder()
|
move_to_test_folder()
|
||||||
|
ctx = build_ctx_from_config_file()
|
||||||
|
|
||||||
extra_script_path = Path(
|
extra_script_path = Path(
|
||||||
"../extra_script/pre-migration-custom_test.sql"
|
"../extra_script/pre-migration-custom_test.sql"
|
||||||
).absolute()
|
).absolute()
|
||||||
|
|
@ -23,7 +25,6 @@ def test_cli_execute_script_sql():
|
||||||
# Deploy SQL Script
|
# Deploy SQL Script
|
||||||
destination_path = Path("scripts/step_01__update__14.0")
|
destination_path = Path("scripts/step_01__update__14.0")
|
||||||
cp([extra_script_path, destination_path])
|
cp([extra_script_path, destination_path])
|
||||||
ctx = build_ctx_from_config_file()
|
|
||||||
|
|
||||||
# Reset database
|
# Reset database
|
||||||
db_name = "database_test_cli___execute_script_sql"
|
db_name = "database_test_cli___execute_script_sql"
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ def test_cli_upgrade():
|
||||||
ensure_database(ctx, db_name, state="absent")
|
ensure_database(ctx, db_name, state="absent")
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"run",
|
"run",
|
||||||
|
|
@ -42,7 +41,6 @@ def test_cli_upgrade():
|
||||||
assert latest_version[0][0].startswith("14.")
|
assert latest_version[0][0].startswith("14.")
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"upgrade",
|
"upgrade",
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,14 @@
|
||||||
import unittest
|
import unittest
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from . import (
|
from . import cli_runner_invoke, move_to_test_folder
|
||||||
build_ctx_from_config_file,
|
|
||||||
cli_runner_invoke,
|
|
||||||
move_to_test_folder,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class TestCliEstimateWorkload(unittest.TestCase):
|
class TestCliEstimateWorkload(unittest.TestCase):
|
||||||
def test_cli_estimate_workload(self):
|
def test_cli_estimate_workload(self):
|
||||||
move_to_test_folder()
|
move_to_test_folder()
|
||||||
ctx = build_ctx_from_config_file()
|
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"estimate-workload",
|
"estimate-workload",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ def test_cli_install_from_csv():
|
||||||
ensure_database(ctx, db_name, state="absent")
|
ensure_database(ctx, db_name, state="absent")
|
||||||
|
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"install-from-csv",
|
"install-from-csv",
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,10 @@ from . import (
|
||||||
|
|
||||||
def test_cli_generate_module_analysis():
|
def test_cli_generate_module_analysis():
|
||||||
move_to_test_folder()
|
move_to_test_folder()
|
||||||
|
ctx = build_ctx_from_config_file()
|
||||||
|
|
||||||
db_name = "database_test_cli___generate_module_analysis"
|
db_name = "database_test_cli___generate_module_analysis"
|
||||||
|
|
||||||
ctx = build_ctx_from_config_file()
|
|
||||||
# identify main analysis file of openupgrade
|
# identify main analysis file of openupgrade
|
||||||
analysis_file_path = get_odoo_env_path(ctx, 15.0) / Path(
|
analysis_file_path = get_odoo_env_path(ctx, 15.0) / Path(
|
||||||
"src/openupgrade/openupgrade_scripts/scripts"
|
"src/openupgrade/openupgrade_scripts/scripts"
|
||||||
|
|
@ -28,7 +29,6 @@ def test_cli_generate_module_analysis():
|
||||||
|
|
||||||
analysis_file_path
|
analysis_file_path
|
||||||
cli_runner_invoke(
|
cli_runner_invoke(
|
||||||
ctx,
|
|
||||||
[
|
[
|
||||||
"--log-level=DEBUG",
|
"--log-level=DEBUG",
|
||||||
"generate-module-analysis",
|
"generate-module-analysis",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user