Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
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
nexedi
cloudooo
Commits
3bb2f679
Commit
3bb2f679
authored
Jan 31, 2018
by
Boris Kocherov
Committed by
Romain Courteaud
Feb 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t.tests: sync magic(signature) with new x2t version
parent
5013b094
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
cloudooo/handler/x2t/tests/testX2tHandler.py
cloudooo/handler/x2t/tests/testX2tHandler.py
+4
-6
No files found.
cloudooo/handler/x2t/tests/testX2tHandler.py
View file @
3bb2f679
...
...
@@ -27,8 +27,6 @@
##############################################################################
import
magic
import
os.path
from
zipfile
import
ZipFile
from
cStringIO
import
StringIO
from
cloudooo.handler.x2t.handler
import
Handler
...
...
@@ -46,7 +44,7 @@ class TestHandler(HandlerTestCase):
"""Test conversion of xlsx to xlsy and back"""
y_data
=
Handler
(
self
.
tmp_url
,
open
(
"data/test.xlsx"
).
read
(),
"xlsx"
,
**
self
.
kw
).
convert
(
"xlsy"
)
y_body_data
=
ZipFile
(
StringIO
(
y_data
)).
open
(
"body.txt"
).
read
()
self
.
assertTrue
(
y_body_data
.
startswith
(
"XLSY;v
2;5883;"
),
"%r... does not start with 'XLSY;v2;5883
;'"
%
(
y_body_data
[:
20
],))
self
.
assertTrue
(
y_body_data
.
startswith
(
"XLSY;v
10;0;"
),
"%r... does not start with 'XLSY;v10;0
;'"
%
(
y_body_data
[:
20
],))
x_data
=
Handler
(
self
.
tmp_url
,
y_data
,
"xlsy"
,
**
self
.
kw
).
convert
(
"xlsx"
)
# magic inspired by https://github.com/minad/mimemagic/pull/19/files
...
...
@@ -61,14 +59,14 @@ class TestHandler(HandlerTestCase):
y_data
=
Handler
(
self
.
tmp_url
,
x_data
,
"xlsx"
,
**
self
.
kw
).
convert
(
"xlsy"
)
y_body_data
=
ZipFile
(
StringIO
(
y_data
)).
open
(
"body.txt"
).
read
()
self
.
assertTrue
(
y_body_data
.
startswith
(
"XLSY;v
2;10579;"
),
"%r... does not start with 'XLSY;v2;10579
;'"
%
(
y_body_data
[:
20
],))
self
.
assertTrue
(
y_body_data
.
startswith
(
"XLSY;v
10;0;"
),
"%r... does not start with 'XLSY;v10;0
;'"
%
(
y_body_data
[:
20
],))
def
testConvertDocx
(
self
):
"""Test conversion of docx to docy and back"""
y_data
=
Handler
(
self
.
tmp_url
,
open
(
"data/test_with_image.docx"
).
read
(),
"docx"
,
**
self
.
kw
).
convert
(
"docy"
)
y_zip
=
ZipFile
(
StringIO
(
y_data
))
y_body_data
=
y_zip
.
open
(
"body.txt"
).
read
()
self
.
assertTrue
(
y_body_data
.
startswith
(
"DOCY;v
5;2795;"
),
"%r... does not start with 'DOCY;v5;2795
;'"
%
(
y_body_data
[:
20
],))
self
.
assertTrue
(
y_body_data
.
startswith
(
"DOCY;v
10;0;"
),
"%r... does not start with 'DOCY;v10;0
;'"
%
(
y_body_data
[:
20
],))
y_zip
.
open
(
"media/image1.png"
)
x_data
=
Handler
(
self
.
tmp_url
,
y_data
,
"docy"
,
**
self
.
kw
).
convert
(
"docx"
)
...
...
@@ -83,7 +81,7 @@ class TestHandler(HandlerTestCase):
y_data
=
Handler
(
self
.
tmp_url
,
x_data
,
"docx"
,
**
self
.
kw
).
convert
(
"docy"
)
y_zip
=
ZipFile
(
StringIO
(
y_data
))
y_body_data
=
y_zip
.
open
(
"body.txt"
).
read
()
self
.
assertTrue
(
y_body_data
.
startswith
(
"DOCY;v
5;7519;"
),
"%r... does not start with 'DOCY;v5;7519
;'"
%
(
y_body_data
[:
20
],))
self
.
assertTrue
(
y_body_data
.
startswith
(
"DOCY;v
10;0;"
),
"%r... does not start with 'DOCY;v10;0
;'"
%
(
y_body_data
[:
20
],))
y_zip
.
open
(
"media/image1.png"
)
def
testgetMetadata
(
self
):
...
...
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