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 ...@@ -33,10 +33,7 @@ import numpy as np
import string import string
import random import random
import urllib import urllib
import requests
import StringIO as st
from Products.ERP5Type.Log import log
def getRandomString(): def getRandomString():
return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \ return 'test_%s' %''.join([random.choice(string.ascii_letters + string.digits) \
...@@ -234,17 +231,11 @@ class Test(ERP5TypeTestCase): ...@@ -234,17 +231,11 @@ class Test(ERP5TypeTestCase):
np.array_equal(data_array.getArraySlice(0,100), \ np.array_equal(data_array.getArraySlice(0,100), \
new_array[:100])) new_array[:100]))
# test get array by request if exists and chech that length is correct # get array by request
data_arrays = self.portal.data_array_module.objectValues() path = '/erp5/data_array_module/' + data_array.getId()
spectrum_array = [o for o in data_arrays if o.getTitle() == 'pydata-spectrum2'] publish_kw = dict(user='ERP5TypeTestCase', env={'RANGE': 'bytes=0-'}, request_method='GET')
if len(spectrum_array) == 1: response = self.publish(path, **publish_kw)
spectrum_array_id = spectrum_array[0].getId() self.assertEquals(int(response.headers["content-length"]), data_array.getSize())
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())
def test_04_DataBucket(self): def test_04_DataBucket(self):
""" """
......
...@@ -46,8 +46,7 @@ ...@@ -46,8 +46,7 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W: 67, 35: Unused variable \'data_product\' (unused-variable)</string> <string>W: 64, 35: Unused variable \'data_product\' (unused-variable)</string>
<string>W: 39, 0: Unused log imported from Products.ERP5Type.Log (unused-import)</string>
</tuple> </tuple>
</value> </value>
</item> </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