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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ludovic Kiefer
erp5
Commits
9eab4dc7
Commit
9eab4dc7
authored
Nov 27, 2015
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: fix usage of ERP5Type.tests.utils.FileUpload.
parent
62238d4b
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12 additions
and
10 deletions
+12
-10
product/ERP5/tests/testERP5Base.py
product/ERP5/tests/testERP5Base.py
+1
-1
product/ERP5/tests/testERP5Commerce.py
product/ERP5/tests/testERP5Commerce.py
+1
-1
product/ERP5/tests/testInvoice.py
product/ERP5/tests/testInvoice.py
+1
-1
product/ERP5/tests/testOrder.py
product/ERP5/tests/testOrder.py
+2
-2
product/ERP5Form/tests/testScribusUtils.py
product/ERP5Form/tests/testScribusUtils.py
+1
-1
product/ERP5OOo/tests/testFormPrintoutAsODG.py
product/ERP5OOo/tests/testFormPrintoutAsODG.py
+1
-1
product/ERP5OOo/tests/testFormPrintoutAsODT.py
product/ERP5OOo/tests/testFormPrintoutAsODT.py
+1
-1
product/ERP5OOo/tests/testOOoDynamicStyle.py
product/ERP5OOo/tests/testOOoDynamicStyle.py
+1
-1
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+3
-1
No files found.
product/ERP5/tests/testERP5Base.py
View file @
9eab4dc7
...
@@ -78,7 +78,7 @@ class TestERP5Base(ERP5TypeTestCase):
...
@@ -78,7 +78,7 @@ class TestERP5Base(ERP5TypeTestCase):
def
makeImageFileUpload
(
self
,
filename
):
def
makeImageFileUpload
(
self
,
filename
):
return
FileUpload
(
return
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'images'
,
filename
)
,
'rb'
)
'test_data'
,
'images'
,
filename
))
def
login
(
self
):
def
login
(
self
):
"""Create a new manager user and login.
"""Create a new manager user and login.
...
...
product/ERP5/tests/testERP5Commerce.py
View file @
9eab4dc7
...
@@ -873,7 +873,7 @@ class TestCommerce(ERP5TypeTestCase):
...
@@ -873,7 +873,7 @@ class TestCommerce(ERP5TypeTestCase):
"""
"""
product
=
self
.
getDefaultProduct
()
product
=
self
.
getDefaultProduct
()
file_upload
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
file_upload
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'images'
,
'erp5_logo_small.png'
)
,
'rb'
)
'test_data'
,
'images'
,
'erp5_logo_small.png'
))
product
.
edit
(
default_image_file
=
file_upload
)
product
.
edit
(
default_image_file
=
file_upload
)
self
.
tic
()
self
.
tic
()
...
...
product/ERP5/tests/testInvoice.py
View file @
9eab4dc7
...
@@ -1704,7 +1704,7 @@ class TestInvoice(TestInvoiceMixin):
...
@@ -1704,7 +1704,7 @@ class TestInvoice(TestInvoiceMixin):
self
.
resource_portal_type
).
newContent
(
self
.
resource_portal_type
).
newContent
(
portal_type
=
self
.
resource_portal_type
,
portal_type
=
self
.
resource_portal_type
,
title
=
'Resource'
,)
title
=
'Resource'
,)
file_data
=
FileUpload
(
__file__
,
'rb'
)
file_data
=
FileUpload
(
__file__
)
client
=
self
.
portal
.
organisation_module
.
newContent
(
client
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'Client'
)
portal_type
=
'Organisation'
,
title
=
'Client'
)
client_logo
=
client
.
newContent
(
portal_type
=
'Embedded File'
,
client_logo
=
client
.
newContent
(
portal_type
=
'Embedded File'
,
...
...
product/ERP5/tests/testOrder.py
View file @
9eab4dc7
...
@@ -2776,7 +2776,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
...
@@ -2776,7 +2776,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type
=
self
.
resource_portal_type
,
portal_type
=
self
.
resource_portal_type
,
title
=
'Resource'
,)
title
=
'Resource'
,)
image
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
image
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'images'
,
'erp5_logo.png'
)
,
'rb'
)
'test_data'
,
'images'
,
'erp5_logo.png'
))
client
=
self
.
portal
.
organisation_module
.
newContent
(
client
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'Client'
,
portal_type
=
'Organisation'
,
title
=
'Client'
,
default_image_file
=
image
)
default_image_file
=
image
)
...
@@ -2813,7 +2813,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
...
@@ -2813,7 +2813,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type
=
self
.
resource_portal_type
,
portal_type
=
self
.
resource_portal_type
,
title
=
'Resource'
,)
title
=
'Resource'
,)
image
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
image
=
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_data'
,
'images'
,
'erp5_logo.bmp'
)
,
'rb'
)
'test_data'
,
'images'
,
'erp5_logo.bmp'
))
client
=
self
.
portal
.
organisation_module
.
newContent
(
client
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
'Client'
,
portal_type
=
'Organisation'
,
title
=
'Client'
,
default_image_file
=
image
)
default_image_file
=
image
)
...
...
product/ERP5Form/tests/testScribusUtils.py
View file @
9eab4dc7
...
@@ -57,7 +57,7 @@ class TestScribusUtils(ERP5TypeTestCase):
...
@@ -57,7 +57,7 @@ class TestScribusUtils(ERP5TypeTestCase):
def
makeFileUpload
(
self
,
filename
):
def
makeFileUpload
(
self
,
filename
):
return
FileUpload
(
return
FileUpload
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'data'
,
filename
)
,
'rb'
)
'data'
,
filename
))
def
test_01_SimpleModuleCreation
(
self
):
def
test_01_SimpleModuleCreation
(
self
):
'''Just create a module using scribus file and pdf file with minimal
'''Just create a module using scribus file and pdf file with minimal
...
...
product/ERP5OOo/tests/testFormPrintoutAsODG.py
View file @
9eab4dc7
...
@@ -304,7 +304,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
...
@@ -304,7 +304,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
current_dir
=
os
.
path
.
dirname
(
__file__
)
current_dir
=
os
.
path
.
dirname
(
__file__
)
parent_dir
=
os
.
path
.
dirname
(
current_dir
)
parent_dir
=
os
.
path
.
dirname
(
current_dir
)
image_path
=
os
.
path
.
join
(
parent_dir
,
'www'
,
'form_printout_icon.png'
)
image_path
=
os
.
path
.
join
(
parent_dir
,
'www'
,
'form_printout_icon.png'
)
file_data
=
FileUpload
(
image_path
,
'rb'
)
file_data
=
FileUpload
(
image_path
)
image
=
person1
.
newContent
(
portal_type
=
'Embedded File'
)
image
=
person1
.
newContent
(
portal_type
=
'Embedded File'
)
image
.
edit
(
file
=
file_data
)
image
.
edit
(
file
=
file_data
)
...
...
product/ERP5OOo/tests/testFormPrintoutAsODT.py
View file @
9eab4dc7
...
@@ -1108,7 +1108,7 @@ return []
...
@@ -1108,7 +1108,7 @@ return []
image_path
=
os
.
path
.
join
(
parent_dir
,
image_path
=
os
.
path
.
join
(
parent_dir
,
'www'
,
'www'
,
'form_printout_icon.png'
)
'form_printout_icon.png'
)
file_data
=
FileUpload
(
image_path
,
'rb'
)
file_data
=
FileUpload
(
image_path
)
image
=
self
.
portal
.
newContent
(
portal_type
=
'Image'
,
id
=
'test_image'
)
image
=
self
.
portal
.
newContent
(
portal_type
=
'Image'
,
id
=
'test_image'
)
image
.
edit
(
file
=
file_data
)
image
.
edit
(
file
=
file_data
)
...
...
product/ERP5OOo/tests/testOOoDynamicStyle.py
View file @
9eab4dc7
...
@@ -216,7 +216,7 @@ return getattr(context, "%s_%s" % (parameter, current_language))
...
@@ -216,7 +216,7 @@ return getattr(context, "%s_%s" % (parameter, current_language))
filename
=
'cmyk_sample.jpg'
filename
=
'cmyk_sample.jpg'
file_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_document'
,
file_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'test_document'
,
filename
)
filename
)
upload_file
=
FileUpload
(
file_path
,
filename
)
upload_file
=
FileUpload
(
file_path
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
upload_file
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
upload_file
)
addOOoTemplate
=
self
.
getPortal
().
manage_addProduct
[
'ERP5OOo'
].
addOOoTemplate
addOOoTemplate
=
self
.
getPortal
().
manage_addProduct
[
'ERP5OOo'
].
addOOoTemplate
addOOoTemplate
(
id
=
'Base_viewIncludeImageAsOdt'
,
title
=
''
)
addOOoTemplate
(
id
=
'Base_viewIncludeImageAsOdt'
,
title
=
''
)
...
...
product/ERP5Type/tests/utils.py
View file @
9eab4dc7
...
@@ -51,7 +51,9 @@ class FileUpload(file):
...
@@ -51,7 +51,9 @@ class FileUpload(file):
"""Act as an uploaded file.
"""Act as an uploaded file.
"""
"""
__allow_access_to_unprotected_subobjects__
=
1
__allow_access_to_unprotected_subobjects__
=
1
def
__init__
(
self
,
path
,
name
):
def
__init__
(
self
,
path
,
name
=
None
):
if
name
is
None
:
name
=
os
.
path
.
basename
(
path
)
self
.
filename
=
name
self
.
filename
=
name
file
.
__init__
(
self
,
path
)
file
.
__init__
(
self
,
path
)
self
.
headers
=
{}
self
.
headers
=
{}
...
...
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