Mathias Markl 7 years ago
parent
commit
393e5a0758
  1. 4
      muk_web_preview_msoffice/demo/preview_office_demo.xml
  2. 2
      muk_web_preview_msoffice/tests/__init__.py
  3. 12
      muk_web_preview_msoffice/tests/test_msoffice_parse.py

4
muk_web_preview_msoffice/demo/preview_office_demo.xml

@ -2,10 +2,10 @@
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<record id="office_attachment_demo" model="ir.attachment">
<record id="msoffice_attachment_demo" model="ir.attachment">
<field name="name">sample.doc</field> <field name="name">sample.doc</field>
<field name="datas_fname">sample.doc</field> <field name="datas_fname">sample.doc</field>
<field name="datas" type="base64" file="muk_web_preview_office/demo/data/sample.doc"/>
<field name="datas" type="base64" file="muk_web_preview_msoffice/demo/data/sample.doc"/>
</record> </record>

2
muk_web_preview_msoffice/tests/__init__.py

@ -19,5 +19,5 @@
# #
################################################################################### ###################################################################################
from . import test_office_parse
from . import test_msoffice_parse

12
muk_web_preview_msoffice/tests/test_office_parse.py → muk_web_preview_msoffice/tests/test_msoffice_parse.py

@ -38,23 +38,23 @@ from odoo.addons.muk_web_preview_mail.controllers import main
_path = os.path.dirname(os.path.dirname(__file__)) _path = os.path.dirname(os.path.dirname(__file__))
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
class OfficeParseTestCase(common.HttpCase):
class MSOfficeParseTestCase(common.HttpCase):
at_install = False at_install = False
post_install = True post_install = True
def setUp(self): def setUp(self):
super(OfficeParseTestCase, self).setUp()
self.sample_office_attachment = self.browse_ref('muk_web_preview_office.office_attachment_demo')
super(MSOfficeParseTestCase, self).setUp()
self.sample_msoffice_attachment = self.browse_ref('muk_web_preview_msoffice.msoffice_attachment_demo')
def tearDown(self): def tearDown(self):
super(OfficeParseTestCase, self).tearDown()
super(MSOfficeParseTestCase, self).tearDown()
def test_parse_office(self):
def test_parse_msoffice(self):
self.authenticate('admin', 'admin') self.authenticate('admin', 'admin')
url = "/web/preview/converter/msoffice" url = "/web/preview/converter/msoffice"
params = {'url': "/web/content?id={}".format( params = {'url': "/web/content?id={}".format(
self.sample_office_attachment.id
self.sample_msoffice_attachment.id
)} )}
url_parts = list(urlparse(url)) url_parts = list(urlparse(url))
query = dict(parse_qsl(url_parts[4])) query = dict(parse_qsl(url_parts[4]))
Loading…
Cancel
Save