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
139
Merge Requests
139
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
b1a92e02
Commit
b1a92e02
authored
Jan 28, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testDms
parent
ecdfd552
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
212 additions
and
208 deletions
+212
-208
bt5/erp5_discussion/TestTemplateItem/portal_components/test.erp5.testERP5Discussion.py
...ateItem/portal_components/test.erp5.testERP5Discussion.py
+4
-5
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testDms.py
...s/TestTemplateItem/portal_components/test.erp5.testDms.py
+170
-164
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testOOoConversionCache.py
...tem/portal_components/test.erp5.testOOoConversionCache.py
+12
-12
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testOOoConversionServerRetry.py
...rtal_components/test.erp5.testOOoConversionServerRetry.py
+5
-6
bt5/erp5_dms_conversion_catalog/TestTemplateItem/portal_components/test.erp5.testDmsWithPreConversion.py
...m/portal_components/test.erp5.testDmsWithPreConversion.py
+3
-3
bt5/erp5_km/TestTemplateItem/portal_components/test.erp5.testKM.py
...km/TestTemplateItem/portal_components/test.erp5.testKM.py
+9
-8
bt5/erp5_pdf_merge/TestTemplateItem/portal_components/test.erp5.testERP5PDFMerge.py
...plateItem/portal_components/test.erp5.testERP5PDFMerge.py
+5
-6
bt5/erp5_run_my_doc/TestTemplateItem/portal_components/test.erp5.testRunMyDoc.py
...tTemplateItem/portal_components/test.erp5.testRunMyDoc.py
+4
-4
No files found.
bt5/erp5_discussion/TestTemplateItem/portal_components/test.erp5.testERP5Discussion.py
View file @
b1a92e02
...
...
@@ -31,11 +31,10 @@
import
unittest
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
erp5.component.test.testDms
import
makeFileUpload
from
erp5.component.test.testDms
import
DocumentUploadTestCase
class
TestERP5Discussion
(
ERP5Type
TestCase
):
class
TestERP5Discussion
(
DocumentUpload
TestCase
):
"""Test for erp5_discussion business template.
"""
...
...
@@ -143,7 +142,7 @@ class TestERP5Discussion(ERP5TypeTestCase):
self
.
assertEqual
(
0
,
len
(
attachment_list
))
# check attachment creation
file_
=
makeFileUpload
(
'TEST-en-002.doc'
)
file_
=
self
.
makeFileUpload
(
'TEST-en-002.doc'
)
web_section1
.
WebSection_createNewDiscussionThread
(
'test1-new-with-attachment'
,
'test1 body'
,
file
=
file_
)
discussion_thread
,
=
[
x
for
x
in
self
.
portal
.
discussion_thread_module
.
objectValues
()
\
if
x
.
getId
()
not
in
discussion_thread_id_set
]
...
...
@@ -240,7 +239,7 @@ class TestERP5Discussion(ERP5TypeTestCase):
web_site_value
=
self
.
portal
.
web_site_module
.
newContent
(
portal_type
=
'Web Site'
)
web_section_value
=
web_site_value
.
newContent
(
portal_type
=
'Web Section'
)
file_
=
makeFileUpload
(
'simple.csv'
)
file_
=
self
.
makeFileUpload
(
'simple.csv'
)
web_section_value
.
WebSection_createNewDiscussionThread
(
"Thread Title"
,
"Post Content"
,
...
...
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testDms.py
View file @
b1a92e02
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testOOoConversionCache.py
View file @
b1a92e02
...
...
@@ -31,7 +31,7 @@
import
unittest
from
DateTime
import
DateTime
from
erp5.component.test.testDms
import
TestDocumentMixin
,
makeFileUpload
from
erp5.component.test.testDms
import
TestDocumentMixin
try
:
import
magic
...
...
@@ -59,7 +59,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
def
test_image_conversion
(
self
):
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
self
.
tic
()
format_
=
'png'
...
...
@@ -96,7 +96,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
Test Conversion Cache mechanism
"""
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
self
.
tic
()
document_url
=
document
.
getRelativeUrl
()
...
...
@@ -129,7 +129,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
def
test_02_VolatileCacheConversionOfTempObject
(
self
):
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
,
temp_object
=
1
)
document
.
uploadFile
()
document
.
processFile
()
...
...
@@ -163,8 +163,8 @@ class TestDocumentConversionCache(TestDocumentMixin):
def
test_03_CacheConversionOfTempObjectIsNotMixed
(
self
):
filename1
=
'TEST-en-002.doc'
filename2
=
'TEST-en-002.odt'
file1
=
makeFileUpload
(
filename1
)
file2
=
makeFileUpload
(
filename2
)
file1
=
self
.
makeFileUpload
(
filename1
)
file2
=
self
.
makeFileUpload
(
filename2
)
document1
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file1
,
temp_object
=
1
)
document1
.
uploadFile
()
document1
.
processFile
()
...
...
@@ -187,7 +187,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
tic
()
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
self
.
tic
()
document_url
=
document
.
getRelativeUrl
()
...
...
@@ -223,7 +223,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
Test Conversion Cache return expected value with checksum
"""
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
self
.
tic
()
document_url
=
document
.
getRelativeUrl
()
...
...
@@ -252,7 +252,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
Check that md5 checksum is well updated when upload a file
"""
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
self
.
tic
()
document_url
=
document
.
getRelativeUrl
()
...
...
@@ -260,7 +260,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
md5sum
=
document
.
getContentMd5
()
self
.
assertTrue
(
md5sum
)
filename2
=
'TEST-en-002.odt'
file2
=
makeFileUpload
(
filename2
)
file2
=
self
.
makeFileUpload
(
filename2
)
document
.
edit
(
file
=
file2
)
self
.
assertNotEqual
(
md5sum
,
document
.
getContentMd5
())
self
.
tic
()
...
...
@@ -275,7 +275,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
tic
()
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document_id
=
'an id with spaces'
portal_type
=
'Text'
module
=
self
.
portal
.
getDefaultModule
(
portal_type
)
...
...
@@ -314,7 +314,7 @@ class TestDocumentConversionCache(TestDocumentMixin):
self
.
assertEqual
(
len
(
portal_type_list
),
len
([
pt
for
pt
in
portal_type_list
if
pt
in
data_mapping
]))
for
portal_type
in
portal_type_list
:
module
=
self
.
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
upload_file
=
makeFileUpload
(
data_mapping
[
portal_type
])
upload_file
=
self
.
makeFileUpload
(
data_mapping
[
portal_type
])
document
=
module
.
newContent
(
portal_type
=
portal_type
)
document
.
edit
(
file
=
upload_file
)
self
.
tic
()
...
...
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testOOoConversionServerRetry.py
View file @
b1a92e02
...
...
@@ -25,12 +25,11 @@
#
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
erp5.component.test.testDms
import
makeFileUpload
from
erp5.component.test.testDms
import
DocumentUploadTestCase
from
Products.ERP5Form.PreferenceTool
import
Priority
class
TestOOoConversionServerRetry
(
ERP5Type
TestCase
):
class
TestOOoConversionServerRetry
(
DocumentUpload
TestCase
):
def
getBusinessTemplateList
(
self
):
business_template_list
=
[
'erp5_core_proxy_field_legacy'
,
'erp5_jquery'
,
...
...
@@ -80,7 +79,7 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
self
.
tic
()
filename
=
'monochrome_sample.tiff'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'Text'
)
document
.
edit
(
file
=
file_
)
message
=
document
.
Document_tryToConvertToBaseFormat
()
...
...
@@ -95,7 +94,7 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
system_pref
.
setPreferredDocumentConversionServerUrlList
([
'https://broken.url'
])
self
.
tic
()
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
message
=
document
.
Document_tryToConvertToBaseFormat
()
...
...
@@ -110,7 +109,7 @@ class TestOOoConversionServerRetry(ERP5TypeTestCase):
system_pref
.
setPreferredOoodocServerTimeout
(
1
)
self
.
tic
()
filename
=
'TEST-en-002.doc'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
message
=
document
.
Document_tryToConvertToBaseFormat
()
...
...
bt5/erp5_dms_conversion_catalog/TestTemplateItem/portal_components/test.erp5.testDmsWithPreConversion.py
View file @
b1a92e02
...
...
@@ -28,7 +28,7 @@
##############################################################################
import
unittest
from
erp5.component.test.testDms
import
TestDocument
,
makeFileUpload
from
erp5.component.test.testDms
import
TestDocument
class
TestDocumentWithPreConversion
(
TestDocument
):
"""
...
...
@@ -40,7 +40,7 @@ class TestDocumentWithPreConversion(TestDocument):
def
test_preConvertedReferencedImageInWebPageContent
(
self
):
# create an image
upload_file
=
makeFileUpload
(
'cmyk_sample.jpg'
)
upload_file
=
self
.
makeFileUpload
(
'cmyk_sample.jpg'
)
image
=
self
.
portal
.
image_module
.
newContent
(
portal_type
=
'Image'
,
reference
=
'Embedded-XXX'
,
version
=
'001'
,
...
...
@@ -75,7 +75,7 @@ class TestDocumentWithPreConversion(TestDocument):
language
=
'en'
)
# draft image is not convertible
upload_file
=
makeFileUpload
(
'cmyk_sample.jpg'
)
upload_file
=
self
.
makeFileUpload
(
'cmyk_sample.jpg'
)
image
.
edit
(
file
=
upload_file
)
self
.
tic
()
self
.
assertEqual
(
False
,
image
.
Base_isConvertible
())
...
...
bt5/erp5_km/TestTemplateItem/portal_components/test.erp5.testKM.py
View file @
b1a92e02
...
...
@@ -31,7 +31,7 @@ import unittest
from
unittest
import
expectedFailure
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Products.ERP5Type.Base
import
TempBase
from
erp5.component.test.testDms
import
makeFileUpload
,
TestDocumentMixin
from
erp5.component.test.testDms
import
TestDocumentMixin
def
_getGadgetInstanceUrlFromKnowledgePad
(
knowledge_pad
,
gadget
):
""" Get Knowledge Box's relative URL specialising a gadget in a Knowledge Pad."""
...
...
@@ -39,6 +39,7 @@ def _getGadgetInstanceUrlFromKnowledgePad(knowledge_pad, gadget):
portal_type
=
'Knowledge Box'
,
specialise_uid
=
gadget
.
getUid
())[
0
].
getObject
().
getRelativeUrl
()
class
TestKMMixIn
(
TestDocumentMixin
):
"""
Mix in class for Knowledge Management system.
...
...
@@ -1008,38 +1009,38 @@ class TestKMSearch(TestKMMixIn):
# create docs to be referenced:
# (1) TEST, 002, en
filename
=
'TEST-en-002.odt'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
# (2) TEST, 002, fr
as_name
=
'TEST-fr-002.odt'
file_
=
makeFileUpload
(
filename
,
as_name
)
file_
=
self
.
makeFileUpload
(
filename
,
as_name
)
document2
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
# (3) TEST, 003, en
as_name
=
'TEST-en-003.odt'
file_
=
makeFileUpload
(
filename
,
as_name
)
file_
=
self
.
makeFileUpload
(
filename
,
as_name
)
document3
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
# create docs to contain references in text_content:
# REF, 002, en; "I use reference to look up TEST"
filename
=
'REF-en-002.odt'
file_
=
makeFileUpload
(
filename
)
file_
=
self
.
makeFileUpload
(
filename
)
document5
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
file_
)
# REFLANG, 001, en: "I use reference and language to look up TEST-fr"
#filename = 'REFLANG-en-001.odt'
#file = makeFileUpload(filename)
#file =
self.
makeFileUpload(filename)
#document6 = self.portal.portal_contributions.newContent(file=file)
# REFVER, 001, en: "I use reference and version to look up TEST-002"
#filename = 'REFVER-en-001.odt'
#file = makeFileUpload(filename)
#file =
self.
makeFileUpload(filename)
#document7 = self.portal.portal_contributions.newContent(file=file)
# REFVERLANG, 001, en: "I use reference, version and language to look up TEST-002-en"
#filename = 'REFVERLANG-en-001.odt'
#file = makeFileUpload(filename)
#file =
self.
makeFileUpload(filename)
#document8 = self.portal.portal_contributions.newContent(file=file)
self
.
tic
()
...
...
bt5/erp5_pdf_merge/TestTemplateItem/portal_components/test.erp5.testERP5PDFMerge.py
View file @
b1a92e02
...
...
@@ -26,14 +26,13 @@
##############################################################################
import
warnings
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
erp5.component.test.testDms
import
makeFileUpload
from
erp5.component.test.testDms
import
DocumentUploadTestCase
original_warnings_showwarnings
=
warnings
.
showwarning
class
TestERP5PDFMerge
(
ERP5Type
TestCase
):
class
TestERP5PDFMerge
(
DocumentUpload
TestCase
):
def
test_showwarning_issue
(
self
):
"""
...
...
@@ -42,7 +41,7 @@ class TestERP5PDFMerge(ERP5TypeTestCase):
"""
self
.
assertEqual
(
warnings
.
showwarning
,
original_warnings_showwarnings
)
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
makeFileUpload
(
'REF-en-001.pdf'
))
file
=
self
.
makeFileUpload
(
'REF-en-001.pdf'
))
merged_pdf_data
=
self
.
portal
.
ERP5Site_mergePDFList
(
[
document
.
getData
(),
document
.
getData
()])
self
.
portal
.
document_module
.
newContent
(
...
...
@@ -53,7 +52,7 @@ class TestERP5PDFMerge(ERP5TypeTestCase):
def
test_erp5_merge_pdf
(
self
):
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
makeFileUpload
(
'REF-en-001.pdf'
))
file
=
self
.
makeFileUpload
(
'REF-en-001.pdf'
))
merged_pdf_data
=
self
.
portal
.
ERP5Site_mergePDFList
(
[
document
.
getData
(),
document
.
getData
()])
merged_document
=
self
.
portal
.
document_module
.
newContent
(
...
...
@@ -63,7 +62,7 @@ class TestERP5PDFMerge(ERP5TypeTestCase):
def
test_erp5_merge_pdf_start_on_recto
(
self
):
document
=
self
.
portal
.
portal_contributions
.
newContent
(
file
=
makeFileUpload
(
'REF-en-001.pdf'
))
file
=
self
.
makeFileUpload
(
'REF-en-001.pdf'
))
merged_pdf_data
=
self
.
portal
.
ERP5Site_mergePDFList
(
[
document
.
getData
(),
document
.
getData
()],
start_on_recto
=
True
)
merged_document
=
self
.
portal
.
document_module
.
newContent
(
...
...
bt5/erp5_run_my_doc/TestTemplateItem/portal_components/test.erp5.testRunMyDoc.py
View file @
b1a92e02
...
...
@@ -26,12 +26,12 @@
#
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
erp5.component.test.testDms
import
makeFileUpload
from
erp5.component.test.testDms
import
DocumentUploadTestCase
from
time
import
time
import
base64
class
TestRunMyDoc
(
ERP5TypeTestCase
):
class
TestRunMyDoc
(
DocumentUploadTestCase
):
"""
Basic Test for internal implementation of RunMyDocs
"""
...
...
@@ -96,7 +96,7 @@ class TestRunMyDoc(ERP5TypeTestCase):
Test Screeshot upload script used by Zelenium to
update screenshots of the documents.
"""
image_upload
=
makeFileUpload
(
'TEST-en-002.png'
)
image_upload
=
self
.
makeFileUpload
(
'TEST-en-002.png'
)
self
.
assertNotEqual
(
None
,
image_upload
)
# Create a web page, and check if the content is not overwriten
...
...
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