Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos
Commits
2e5bfa9a
Commit
2e5bfa9a
authored
Sep 05, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/erp5_upgrade/test: port the tests to python3
parent
5b2f7cd0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
software/erp5/upgrade_test/setup.py
software/erp5/upgrade_test/setup.py
+0
-1
software/erp5/upgrade_test/test.py
software/erp5/upgrade_test/test.py
+8
-12
No files found.
software/erp5/upgrade_test/setup.py
View file @
2e5bfa9a
...
@@ -44,7 +44,6 @@ setup(name=name,
...
@@ -44,7 +44,6 @@ setup(name=name,
'slapos.core'
,
'slapos.core'
,
'supervisor'
,
'supervisor'
,
'slapos.libnetworkcache'
,
'slapos.libnetworkcache'
,
'typing; python_version<"3"'
,
],
],
test_suite
=
'test'
,
test_suite
=
'test'
,
)
)
software/erp5/upgrade_test/test.py
View file @
2e5bfa9a
...
@@ -35,8 +35,8 @@ import tempfile
...
@@ -35,8 +35,8 @@ import tempfile
import
time
import
time
import
requests
import
requests
import
six.moves.urllib
as
urllib
import
urllib.parse
import
six.moves.xmlrpc_
client
import
xmlrpc.
client
import
urllib3
import
urllib3
from
slapos.grid.utils
import
md5digest
from
slapos.grid.utils
import
md5digest
...
@@ -83,8 +83,8 @@ class ERP5UpgradeTestCase(SlapOSInstanceTestCase):
...
@@ -83,8 +83,8 @@ class ERP5UpgradeTestCase(SlapOSInstanceTestCase):
@
classmethod
@
classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
# request and instan
c
iate with old software url
# request and instan
t
iate with old software url
super
(
ERP5UpgradeTestCase
,
cls
).
setUpClass
()
super
().
setUpClass
()
cls
.
setUpOldInstance
()
cls
.
setUpOldInstance
()
...
@@ -155,7 +155,7 @@ class TestERP5Upgrade(ERP5UpgradeTestCase):
...
@@ -155,7 +155,7 @@ class TestERP5Upgrade(ERP5UpgradeTestCase):
# wait for old site creation
# wait for old site creation
cls
.
session
.
get
(
cls
.
session
.
get
(
'{zope_base_url}/person_module'
.
format
(
zope_base_url
=
cls
.
zope_base_url
)
,
f'
{
cls
.
zope_base_url
}
/person_module'
,
auth
=
requests
.
auth
.
HTTPBasicAuth
(
auth
=
requests
.
auth
.
HTTPBasicAuth
(
username
=
param_dict
[
'inituser-login'
],
username
=
param_dict
[
'inituser-login'
],
password
=
param_dict
[
'inituser-password'
],
password
=
param_dict
[
'inituser-password'
],
...
@@ -171,16 +171,12 @@ class TestERP5Upgrade(ERP5UpgradeTestCase):
...
@@ -171,16 +171,12 @@ class TestERP5Upgrade(ERP5UpgradeTestCase):
ssl_context
=
ssl
.
create_default_context
()
ssl_context
=
ssl
.
create_default_context
()
ssl_context
.
check_hostname
=
False
ssl_context
.
check_hostname
=
False
ssl_context
.
verify_mode
=
ssl
.
CERT_NONE
ssl_context
.
verify_mode
=
ssl
.
CERT_NONE
erp5_xmlrpc_client
=
six
.
moves
.
xmlrpc_
client
.
ServerProxy
(
erp5_xmlrpc_client
=
xmlrpc
.
client
.
ServerProxy
(
cls
.
authenticated_zope_base_url
,
cls
.
authenticated_zope_base_url
,
context
=
ssl_context
,
context
=
ssl_context
,
)
)
# BBB use as a context manager only on python3
with
erp5_xmlrpc_client
:
if
sys
.
version_info
<
(
3
,
):
yield
erp5_xmlrpc_client
yield
erp5_xmlrpc_client
else
:
with
erp5_xmlrpc_client
:
yield
erp5_xmlrpc_client
def
addPythonScript
(
script_id
,
params
,
body
):
def
addPythonScript
(
script_id
,
params
,
body
):
with
getXMLRPCClient
()
as
erp5_xmlrpc_client
:
with
getXMLRPCClient
()
as
erp5_xmlrpc_client
:
...
@@ -188,7 +184,7 @@ class TestERP5Upgrade(ERP5UpgradeTestCase):
...
@@ -188,7 +184,7 @@ class TestERP5Upgrade(ERP5UpgradeTestCase):
try
:
try
:
custom
.
manage_addProduct
.
PythonScripts
.
manage_addPythonScript
(
custom
.
manage_addProduct
.
PythonScripts
.
manage_addPythonScript
(
script_id
)
script_id
)
except
six
.
moves
.
xmlrpc_
client
.
ProtocolError
as
e
:
except
xmlrpc
.
client
.
ProtocolError
as
e
:
if
e
.
errcode
!=
302
:
if
e
.
errcode
!=
302
:
raise
raise
getattr
(
custom
,
script_id
).
ZPythonScriptHTML_editAction
(
getattr
(
custom
,
script_id
).
ZPythonScriptHTML_editAction
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment