Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
5957143d
Commit
5957143d
authored
Apr 11, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_test_core: pylint
parent
4fb016aa
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
17 deletions
+19
-17
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
.../TestTemplateItem/portal_components/test.erp5.testBase.py
+0
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
...ateItem/portal_components/test.erp5.testCookieCrumbler.py
+2
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
...tTemplateItem/portal_components/test.erp5.testERP5Base.py
+1
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Type.py
...tTemplateItem/portal_components/test.erp5.testERP5Type.py
+0
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
...lateItem/portal_components/test.erp5.testIdToolUpgrade.py
+0
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.py
...em/portal_components/test.erp5.testWorkflowHistoryList.py
+3
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXForwardedFor.py
...lateItem/portal_components/test.erp5.testXForwardedFor.py
+8
-6
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXMLPickle.py
...TemplateItem/portal_components/test.erp5.testXMLPickle.py
+5
-3
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBase.py
View file @
5957143d
...
...
@@ -30,7 +30,6 @@
import
io
import
unittest
import
os
from
unittest
import
skip
from
Testing
import
ZopeTestCase
...
...
@@ -1048,8 +1047,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
None
,
obj
.
getViewPermissionOwner
())
def
test_Member_Base_download
(
self
):
import
Products.ERP5Type
# tests that members can download files
class
DummyFile
(
io
.
BytesIO
):
filename
=
'dummy.txt'
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
View file @
5957143d
...
...
@@ -12,10 +12,12 @@
##############################################################################
import
six
# pylint:disable=no-name-in-module
if
six
.
PY2
:
from
base64
import
encodestring
as
base64_encodebytes
else
:
from
base64
import
encodebytes
as
base64_encodebytes
# pylint:enable=no-name-in-module
from
six.moves
import
cStringIO
as
StringIO
import
unittest
from
six.moves.urllib.parse
import
quote
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
View file @
5957143d
...
...
@@ -36,7 +36,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
FileUpload
from
AccessControl.SecurityManagement
import
newSecurityManager
import
six
class
TestERP5Base
(
ERP5TypeTestCase
):
"""ERP5 Base tests.
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Type.py
View file @
5957143d
...
...
@@ -27,7 +27,6 @@
##############################################################################
import
unittest
import
sys
import
mock
import
transaction
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
View file @
5957143d
...
...
@@ -27,7 +27,6 @@
#
##############################################################################
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.Globals
import
PersistentMapping
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.py
View file @
5957143d
...
...
@@ -67,7 +67,7 @@ def old(items):
if
len
(
whl
.
_log
)
<
16
:
whl
.
_log
.
append
(
item
)
else
:
prev
=
whl
.
__new__
(
whl
.
__class__
)
prev
=
whl
.
__new__
(
whl
.
__class__
)
# pylint:disable=no-value-for-parameter
prev
.
_prev
=
whl
.
_prev
prev
.
_log
=
whl
.
_log
whl
.
_prev
=
prev
...
...
@@ -91,7 +91,8 @@ class TestWorkflowHistoryList(TestCase):
self
.
assertEqual
(
ddl
,
new
(
type
(
ddl
),
EXPECTED
))
class
check
(
object
):
def
__getitem__
(
_
,
item
):
# pylint: disable=no-self-argument
def
__getitem__
(
self_
,
item
):
# pylint: disable=no-self-argument
del
self_
try
:
a
=
EXPECTED
[
item
]
except
IndexError
:
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXForwardedFor.py
View file @
5957143d
...
...
@@ -30,7 +30,7 @@ from Products.ERP5Type.tests.runUnitTest import log_directory
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
os
import
requests
import
unittest
def
get_Z2_log_last_line
():
z2_log_path
=
os
.
path
.
join
(
log_directory
,
'Z2.log'
)
...
...
@@ -43,6 +43,7 @@ def get_Z2_log_last_line():
f
.
close
()
return
last_line
class
TestXForwardedFor
(
ERP5TypeTestCase
):
def
test_request_with_x_forwarded_for
(
self
):
script_container
=
self
.
portal
.
portal_skins
.
custom
...
...
@@ -56,6 +57,7 @@ class TestXForwardedFor(ERP5TypeTestCase):
response
=
requests
.
get
(
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
script_id
),
headers
=
{
'X-Forwarded-For'
:
'1.2.3.4'
},
timeout
=
5
,
)
self
.
assertNotEqual
(
response
.
text
,
'1.2.3.4'
)
last_line
=
get_Z2_log_last_line
()
...
...
@@ -63,6 +65,7 @@ class TestXForwardedFor(ERP5TypeTestCase):
response
=
requests
.
get
(
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
script_id
),
headers
=
{
'X-Forwarded-For'
:
'1.2.3.4, 5.6.7.8'
},
timeout
=
5
,
)
self
.
assertNotEqual
(
response
.
text
,
'1.2.3.4'
)
self
.
assertNotEqual
(
response
.
text
,
'5.6.7.8'
)
...
...
@@ -71,6 +74,7 @@ class TestXForwardedFor(ERP5TypeTestCase):
self
.
assertFalse
(
last_line
.
startswith
(
'5.6.7.8 - '
),
last_line
)
response
=
requests
.
get
(
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
script_id
),
timeout
=
5
,
)
self
.
assertNotEqual
(
response
.
text
,
'1.2.3.4'
)
last_line
=
get_Z2_log_last_line
()
...
...
@@ -81,6 +85,7 @@ class TestXForwardedFor(ERP5TypeTestCase):
response
=
requests
.
get
(
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
script_id
),
headers
=
{
'X-Forwarded-For'
:
'1.2.3.4'
},
timeout
=
5
,
)
self
.
assertEqual
(
response
.
text
,
'1.2.3.4'
)
last_line
=
get_Z2_log_last_line
()
...
...
@@ -88,18 +93,15 @@ class TestXForwardedFor(ERP5TypeTestCase):
response
=
requests
.
get
(
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
script_id
),
headers
=
{
'X-Forwarded-For'
:
'1.2.3.4, 5.6.7.8'
},
timeout
=
5
,
)
self
.
assertEqual
(
response
.
text
,
'1.2.3.4'
)
last_line
=
get_Z2_log_last_line
()
self
.
assertTrue
(
last_line
.
startswith
(
'1.2.3.4 - '
),
last_line
)
response
=
requests
.
get
(
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
script_id
),
timeout
=
5
,
)
self
.
assertNotEqual
(
response
.
text
,
'1.2.3.4'
)
last_line
=
get_Z2_log_last_line
()
self
.
assertFalse
(
last_line
.
startswith
(
'1.2.3.4 - '
),
last_line
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestXForwardedFor
))
return
suite
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXMLPickle.py
View file @
5957143d
...
...
@@ -60,10 +60,10 @@ class XMLPickleTestCase(unittest.TestCase):
class
DummyJar
:
loaded
=
None
"""follow interface expected by importXML"""
def
importFile
(
self
,
file
,
clue
):
def
importFile
(
self
,
file
_
,
clue
):
assertEqual
(
clue
,
'ignored'
)
assertEqual
(
file
.
read
(
4
),
b'ZEXP'
)
unpickler
=
pickle
.
Unpickler
(
file
)
assertEqual
(
file
_
.
read
(
4
),
b'ZEXP'
)
unpickler
=
pickle
.
Unpickler
(
file
_
)
if
persistent_load
:
unpickler
.
persistent_load
=
persistent_load
self
.
loaded
=
unpickler
.
load
()
...
...
@@ -126,6 +126,7 @@ class TestXMLPickle(XMLPickleTestCase):
if
six
.
PY2
:
def
test_long
(
self
):
# pylint:disable=undefined-variable
self
.
check_and_load
(
long
(
-
0
))
self
.
check_and_load
(
long
(
1
))
self
.
check_and_load
(
long
(
-
1
))
...
...
@@ -134,6 +135,7 @@ class TestXMLPickle(XMLPickleTestCase):
self
.
check_and_load
(
long
(
0xffff
))
self
.
check_and_load
(
long
(
2
**
128
))
self
.
check_and_load
(
12345678910111213141516178920
<<
(
256
*
8
))
# pylint:enable=undefined-variable
def
test_float
(
self
):
self
.
check_and_load
(
-
0.0
)
...
...
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