2021-08-02 14:04:47 +00:00
|
|
|
from tests.base_test import BaseTest
|
|
|
|
|
2021-09-02 13:57:01 +00:00
|
|
|
from crc import app
|
2021-08-03 15:56:53 +00:00
|
|
|
|
2021-09-02 13:57:01 +00:00
|
|
|
import io
|
2021-09-07 19:15:38 +00:00
|
|
|
from lxml import etree
|
2021-09-02 13:57:01 +00:00
|
|
|
import os
|
2021-08-02 14:04:47 +00:00
|
|
|
|
|
|
|
|
2021-09-02 13:57:01 +00:00
|
|
|
class TestDMNFromSS(BaseTest):
|
|
|
|
|
|
|
|
def test_dmn_from_ss(self):
|
|
|
|
|
|
|
|
filepath = os.path.join(app.root_path, '..', 'tests', 'data',
|
|
|
|
'dmn_from_spreadsheet', 'large_test_spreadsheet.xlsx')
|
|
|
|
f_handle = open(filepath, 'br')
|
|
|
|
ss_data = f_handle.read()
|
|
|
|
|
2021-09-07 19:15:38 +00:00
|
|
|
data = {'file': (io.BytesIO(ss_data), 'test.xlsx')}
|
|
|
|
rv = self.app.post('/v1.0/dmn_from_ss', data=data, follow_redirects=True,
|
|
|
|
content_type='multipart/form-data', headers=self.logged_in_headers())
|
2021-09-02 13:57:01 +00:00
|
|
|
|
2021-09-07 19:15:38 +00:00
|
|
|
dmn_xml = rv.stream.response.data
|
|
|
|
root = etree.fromstring(dmn_xml)
|
|
|
|
children = root.getchildren()
|
|
|
|
self.assertEqual('{https://www.omg.org/spec/DMN/20191111/MODEL/}decision', children[0].tag)
|
|
|
|
self.assertEqual('{https://www.omg.org/spec/DMN/20191111/DMNDI/}DMNDI', children[1].tag)
|