Commit 018f09db authored by Ekaterina's avatar Ekaterina

erp5_wendelin: fix the test to get array by request

parent 35447649
......@@ -33,10 +33,7 @@ import numpy as np
import string
import random
import urllib
import requests
import StringIO as st
from Products.ERP5Type.Log import log
def getRandomString():
return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \
......@@ -234,17 +231,11 @@ class Test(ERP5TypeTestCase):
np.array_equal(data_array.getArraySlice(0,100), \
new_array[:100]))
# test get array by request if exists and chech that length is correct
data_arrays = self.portal.data_array_module.objectValues()
spectrum_array = [o for o in data_arrays if o.getTitle() == 'pydata-spectrum2']
if len(spectrum_array) == 1:
spectrum_array_id = spectrum_array[0].getId()
headers = {'Range': 'bytes=0-'}
url = 'https://softinst127199.host.vifib.net/erp5/web_site_module/pydata_runner/hateoas/data_array_module/' + spectrum_array_id
response = requests.get(url, auth=('zope', 'aybvtnkf'), headers=headers)
response_string = st.StringIO()
response_string.write(response.content)
self.assertEquals(response_string.len, spectrum_array[0].getSize())
# get array by request
path = '/erp5/data_array_module/' + data_array.getId()
publish_kw = dict(user='ERP5TypeTestCase', env={'RANGE': 'bytes=0-'}, request_method='GET')
response = self.publish(path, **publish_kw)
self.assertEquals(int(response.headers["content-length"]), data_array.getSize())
def test_04_DataBucket(self):
"""
......
......@@ -46,8 +46,7 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 67, 35: Unused variable \'data_product\' (unused-variable)</string>
<string>W: 39, 0: Unused log imported from Products.ERP5Type.Log (unused-import)</string>
<string>W: 64, 35: Unused variable \'data_product\' (unused-variable)</string>
</tuple>
</value>
</item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment