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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Jérome Perrin
cloudooo
Commits
fa7ed25b
Commit
fa7ed25b
authored
Apr 22, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: use assertIsInstance
This does not need the types module which no longer exist
parent
2c7959c0
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
16 deletions
+12
-16
cloudooo/handler/ooo/tests/testOooMonitorMemory.py
cloudooo/handler/ooo/tests/testOooMonitorMemory.py
+2
-3
cloudooo/handler/ooo/tests/testOooOdfDocument.py
cloudooo/handler/ooo/tests/testOooOdfDocument.py
+2
-2
cloudooo/handler/ooo/tests/testOooServer.py
cloudooo/handler/ooo/tests/testOooServer.py
+6
-7
cloudooo/handler/pdf/tests/testPdfHandler.py
cloudooo/handler/pdf/tests/testPdfHandler.py
+1
-2
cloudooo/tests/cloudoooTestCase.py
cloudooo/tests/cloudoooTestCase.py
+1
-2
No files found.
cloudooo/handler/ooo/tests/testOooMonitorMemory.py
View file @
fa7ed25b
...
...
@@ -33,7 +33,6 @@ from time import sleep
from
cloudooo.handler.ooo.application.openoffice
import
openoffice
from
cloudooo.handler.ooo.monitor.memory
import
MonitorMemory
from
psutil
import
Process
from
types
import
IntType
OPENOFFICE
=
True
...
...
@@ -94,7 +93,7 @@ class TestMonitorMemory(unittest.TestCase):
self
.
monitor
=
MonitorMemory
(
openoffice
,
2
,
400
)
self
.
monitor
.
create_process
()
self
.
assertTrue
(
hasattr
(
self
.
monitor
,
'process'
))
self
.
assert
Equal
(
type
(
self
.
monitor
.
process
)
,
Process
)
self
.
assert
IsInstance
(
self
.
monitor
.
process
,
Process
)
def
testGetMemoryUsage
(
self
):
"""Test memory usage"""
...
...
@@ -105,6 +104,6 @@ class TestMonitorMemory(unittest.TestCase):
if
not
openoffice
.
status
():
openoffice
.
start
()
memory_usage_int
=
self
.
monitor
.
get_memory_usage
()
self
.
assert
Equal
(
type
(
memory_usage_int
),
IntType
)
self
.
assert
IsInstance
(
memory_usage_int
,
int
)
cloudooo/handler/ooo/tests/testOooOdfDocument.py
View file @
fa7ed25b
...
...
@@ -43,7 +43,7 @@ class TestOdfDocument(HandlerTestCase):
def
testReceivedGoodFile
(
self
):
"""Test if received path is from a good document returing an ZipFile"""
self
.
assert
True
(
isinstance
(
self
.
oodocument
.
_zipfile
,
ZipFile
)
)
self
.
assert
IsInstance
(
self
.
oodocument
.
_zipfile
,
ZipFile
)
def
testGetContentXml
(
self
):
"""Test if the getContentXml method returns the content.xml file"""
...
...
@@ -63,7 +63,7 @@ class TestOdfDocument(HandlerTestCase):
def
testParseContent
(
self
):
"""Test if the _parsed_content attribute is the parsed content.xml"""
# XXX not sure it is good to store parsed document everytime
self
.
assert
True
(
isinstance
(
self
.
oodocument
.
parsed_content
,
etree
.
_Element
)
)
self
.
assert
IsInstance
(
self
.
oodocument
.
parsed_content
,
etree
.
_Element
)
self
.
assertTrue
(
self
.
oodocument
.
parsed_content
.
tag
.
endswith
(
'document-content'
))
...
...
cloudooo/handler/ooo/tests/testOooServer.py
View file @
fa7ed25b
...
...
@@ -34,7 +34,6 @@ from os import remove
from
base64
import
encodestring
,
decodestring
from
StringIO
import
StringIO
from
lxml
import
etree
from
types
import
DictType
from
zipfile
import
ZipFile
,
is_zipfile
from
cloudooo.tests.cloudoooTestCase
import
TestCase
from
cloudooo.tests.backportUnittest
import
expectedFailure
...
...
@@ -226,7 +225,7 @@ class TestGetMetadata(TestCase):
'application/vnd.oasis.opendocument.text'
)
response_code
,
response_dict
,
response_message
=
generate_result
self
.
assertEqual
(
response_code
,
200
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
self
.
assertNotEqual
(
response_dict
[
'data'
],
''
)
self
.
assertEqual
(
response_dict
[
'mime'
],
'application/pdf'
)
...
...
@@ -245,7 +244,7 @@ class TestGenerate(TestCase):
"application/vnd.oasis.opendocument.spreadsheet"
)
response_code
,
response_dict
,
response_message
=
generate_result
self
.
assertEqual
(
response_code
,
200
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
self
.
assertNotEqual
(
response_dict
[
'data'
],
''
)
self
.
assertEqual
(
response_dict
[
'mime'
],
'application/zip'
)
output_url
=
join
(
self
.
tmp_url
,
"zip.zip"
)
...
...
@@ -272,7 +271,7 @@ class TestGenerate(TestCase):
"application/vnd.oasis.opendocument.spreadsheet"
)
response_code
,
response_dict
,
response_message
=
generate_result
self
.
assertEqual
(
response_code
,
200
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
self
.
assertNotEqual
(
response_dict
[
'data'
],
''
)
self
.
assertEqual
(
response_dict
[
'mime'
],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
)
...
...
@@ -289,7 +288,7 @@ class TestGenerate(TestCase):
'application/vnd.oasis.opendocument.presentation'
)
response_code
,
response_dict
,
response_message
=
generate_result
self
.
assertEqual
(
response_code
,
200
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
self
.
assertNotEqual
(
response_dict
[
'data'
],
''
)
self
.
assertEqual
(
response_dict
[
'mime'
],
'application/zip'
)
output_url
=
join
(
self
.
tmp_url
,
"zip.zip"
)
...
...
@@ -323,7 +322,7 @@ class TestGenerate(TestCase):
'application/vnd.oasis.opendocument.presentation'
)
response_code
,
response_dict
,
response_message
=
generate_result
self
.
assertEqual
(
response_code
,
200
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
self
.
assertNotEqual
(
response_dict
[
'data'
],
''
)
self
.
assertEqual
(
response_dict
[
'mime'
],
'application/zip'
)
output_url
=
join
(
self
.
tmp_url
,
"zip.zip"
)
...
...
@@ -351,7 +350,7 @@ class TestGenerate(TestCase):
None
,
'pdf'
,
'application/vnd.oasis.opendocument.text'
)
response_code
,
response_dict
,
response_message
=
generate_result
self
.
assertEqual
(
response_code
,
402
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
self
.
assertEqual
(
response_dict
,
{})
self
.
assertTrue
(
response_message
.
startswith
(
'Traceback'
))
...
...
cloudooo/handler/pdf/tests/testPdfHandler.py
View file @
fa7ed25b
...
...
@@ -31,7 +31,6 @@
from
cloudooo.handler.pdf.handler
import
Handler
from
cloudooo.tests.handlerTestCase
import
HandlerTestCase
from
types
import
DictType
class
TestHandler
(
HandlerTestCase
):
...
...
@@ -53,7 +52,7 @@ class TestHandler(HandlerTestCase):
pdf_document
=
f
.
read
()
handler
=
Handler
(
self
.
tmp_url
,
pdf_document
,
"pdf"
,
**
self
.
kw
)
metadata
=
handler
.
getMetadata
()
self
.
assert
Equal
(
type
(
metadata
),
DictType
)
self
.
assert
IsInstance
(
metadata
,
dict
)
self
.
assertNotEqual
(
metadata
,
{})
self
.
assertEqual
(
metadata
[
"title"
],
'Free Cloud Alliance Presentation'
)
...
...
cloudooo/tests/cloudoooTestCase.py
View file @
fa7ed25b
...
...
@@ -33,7 +33,6 @@ from os import environ, path
from
ConfigParser
import
ConfigParser
from
xmlrpclib
import
ServerProxy
,
Fault
from
magic
import
Magic
from
types
import
DictType
from
base64
import
encodestring
,
decodestring
from
cloudooo.tests
import
backportUnittest
...
...
@@ -132,7 +131,7 @@ class TestCase(backportUnittest.TestCase):
response_code
,
response_dict
,
response_message
=
\
self
.
proxy
.
run_convert
(
filename
,
encodestring
(
data
))
self
.
assertEqual
(
response_code
,
expected_response_code
)
self
.
assert
Equal
(
type
(
response_dict
),
DictType
)
self
.
assert
IsInstance
(
response_dict
,
dict
)
if
expected_response_code
==
402
:
self
.
assertEqual
(
response_dict
,
{})
self
.
assertTrue
(
response_message
.
endswith
(
expected_response_message
),
...
...
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