Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
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
Tristan Cavelier
cloudooo
Commits
95eb437e
Commit
95eb437e
authored
Oct 11, 2016
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x2t: update tests
parent
7658d236
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
cloudooo/handler/x2t/tests/data/test.xlsy
cloudooo/handler/x2t/tests/data/test.xlsy
+0
-0
cloudooo/handler/x2t/tests/testX2tHandler.py
cloudooo/handler/x2t/tests/testX2tHandler.py
+6
-2
cloudooo/handler/x2t/tests/testX2tServer.py
cloudooo/handler/x2t/tests/testX2tServer.py
+1
-1
No files found.
cloudooo/handler/x2t/tests/data/test.xlsy
View file @
95eb437e
No preview for this file type
cloudooo/handler/x2t/tests/testX2tHandler.py
View file @
95eb437e
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
import
magic
import
magic
import
os.path
import
os.path
from
zipfile
import
ZipFile
from
cStringIO
import
StringIO
from
cloudooo.handler.x2t.handler
import
Handler
from
cloudooo.handler.x2t.handler
import
Handler
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
,
make_suite
...
@@ -40,7 +42,8 @@ class TestHandler(HandlerTestCase):
...
@@ -40,7 +42,8 @@ class TestHandler(HandlerTestCase):
def
testConvertXlsx
(
self
):
def
testConvertXlsx
(
self
):
"""Test conversion of xlsx to xlsy and back"""
"""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_data
=
Handler
(
self
.
tmp_url
,
open
(
"data/test.xlsx"
).
read
(),
"xlsx"
,
**
self
.
kw
).
convert
(
"xlsy"
)
self
.
assertTrue
(
y_data
.
startswith
(
"XLSY;v2;5883;"
),
"%r... does not start with 'XLSY;v2;5883;'"
%
(
y_data
[:
20
],))
y_body_data
=
ZipFile
(
StringIO
(
y_data
)).
open
(
"body.txt"
).
read
()
self
.
assertTrue
(
y_body_data
.
startswith
(
"XLSY;v2;5883;"
),
"%r... does not start with 'XLSY;v2;5883;'"
%
(
y_body_data
[:
20
],))
x_data
=
Handler
(
self
.
tmp_url
,
y_data
,
"xlsy"
,
**
self
.
kw
).
convert
(
"xlsx"
)
x_data
=
Handler
(
self
.
tmp_url
,
y_data
,
"xlsy"
,
**
self
.
kw
).
convert
(
"xlsx"
)
# magic inspired by https://github.com/minad/mimemagic/pull/19/files
# magic inspired by https://github.com/minad/mimemagic/pull/19/files
...
@@ -52,7 +55,8 @@ class TestHandler(HandlerTestCase):
...
@@ -52,7 +55,8 @@ class TestHandler(HandlerTestCase):
self
.
assertIn
(
"xl/"
,
x_data
[:
2000
])
self
.
assertIn
(
"xl/"
,
x_data
[:
2000
])
y_data
=
Handler
(
self
.
tmp_url
,
x_data
,
"xlsx"
,
**
self
.
kw
).
convert
(
"xlsy"
)
y_data
=
Handler
(
self
.
tmp_url
,
x_data
,
"xlsx"
,
**
self
.
kw
).
convert
(
"xlsy"
)
self
.
assertTrue
(
y_data
.
startswith
(
"XLSY;v2;10579;"
),
"%r... does not start with 'XLSY;v2;10579;'"
%
(
y_data
[:
20
],))
y_body_data
=
ZipFile
(
StringIO
(
y_data
)).
open
(
"body.txt"
).
read
()
self
.
assertTrue
(
y_body_data
.
startswith
(
"XLSY;v2;10579;"
),
"%r... does not start with 'XLSY;v2;10579;'"
%
(
y_body_data
[:
20
],))
def
testgetMetadataFromImage
(
self
):
def
testgetMetadataFromImage
(
self
):
"""Test getMetadata not implemented form yformats"""
"""Test getMetadata not implemented form yformats"""
...
...
cloudooo/handler/x2t/tests/testX2tServer.py
View file @
95eb437e
...
@@ -33,7 +33,7 @@ class TestServer(TestCase):
...
@@ -33,7 +33,7 @@ class TestServer(TestCase):
def
ConversionScenarioList
(
self
):
def
ConversionScenarioList
(
self
):
return
[
return
[
(
join
(
'data'
,
'test.xlsx'
),
"xlsx"
,
"xlsy"
,
"
text/plain"
),
# XXX no mime mapping for xlsy ?
(
join
(
'data'
,
'test.xlsx'
),
"xlsx"
,
"xlsy"
,
"
application/zip"
),
(
join
(
'data'
,
'test.xlsy'
),
"xlsy"
,
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
),
(
join
(
'data'
,
'test.xlsy'
),
"xlsy"
,
"xlsx"
,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
),
]
]
...
...
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