TEST - WIP
This commit is contained in:
parent
17e8040712
commit
c717c04bd0
|
|
@ -122,7 +122,11 @@ def execute_psql_command(
|
||||||
):
|
):
|
||||||
"""Execute psql request in postgres container with psql_args on database"""
|
"""Execute psql request in postgres container with psql_args on database"""
|
||||||
container = get_postgres_container(ctx)
|
container = get_postgres_container(ctx)
|
||||||
|
logger.warning("DEBUG ========= execute_psql_command")
|
||||||
|
logger.warning("request: ", request)
|
||||||
|
logger.warning("database: ", database)
|
||||||
escaped_request = request.replace('"', '\\"')
|
escaped_request = request.replace('"', '\\"')
|
||||||
|
logger.warning("escaped_request: ", escaped_request)
|
||||||
command = (
|
command = (
|
||||||
"psql"
|
"psql"
|
||||||
" --username=odoo"
|
" --username=odoo"
|
||||||
|
|
@ -130,6 +134,7 @@ def execute_psql_command(
|
||||||
f' --command "{escaped_request}"'
|
f' --command "{escaped_request}"'
|
||||||
f" {' '.join(psql_args)}"
|
f" {' '.join(psql_args)}"
|
||||||
)
|
)
|
||||||
|
logger.warning("command: ", command)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Executing the following command in postgres container\n"
|
"Executing the following command in postgres container\n"
|
||||||
"%s" % (command)
|
"%s" % (command)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ from pytest import raises
|
||||||
|
|
||||||
from odoo_openupgrade_wizard.tools.tools_postgres import (
|
from odoo_openupgrade_wizard.tools.tools_postgres import (
|
||||||
ensure_database,
|
ensure_database,
|
||||||
execute_psql_command,
|
execute_sql_request,
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
|
@ -38,12 +38,7 @@ def test_cli_psql():
|
||||||
" WHERE state ='installed'"
|
" WHERE state ='installed'"
|
||||||
" AND name='base';"
|
" AND name='base';"
|
||||||
)
|
)
|
||||||
output = execute_psql_command(
|
output = execute_sql_request(ctx, request)
|
||||||
ctx,
|
|
||||||
request,
|
|
||||||
database=db_name,
|
|
||||||
psql_args=("--tuples-only",),
|
|
||||||
)
|
|
||||||
assert output.strip() == "base"
|
assert output.strip() == "base"
|
||||||
|
|
||||||
# test via cli ok
|
# test via cli ok
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user