Commit 98d77b78 authored by Ivan Tyagov's avatar Ivan Tyagov

Extend test to cover data upload.

Upload 1Mb of data.
parent 96868dd4
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import io
import datetime import datetime
import random import random
import time import time
...@@ -29,7 +29,7 @@ def createDataStream(result, browser): ...@@ -29,7 +29,7 @@ def createDataStream(result, browser):
browser.mainForm.submitSelectModule(value='/data_stream_module', browser.mainForm.submitSelectModule(value='/data_stream_module',
sleep=(TMIN_SLEEP, TMAX_SLEEP))) sleep=(TMIN_SLEEP, TMAX_SLEEP)))
# Create a newData Stream (XXX: this will create Data Stream Bucket!) # Create a newData Stream
result('Create', result('Create',
browser.mainForm.submitNew(sleep=(TMIN_SLEEP, TMAX_SLEEP))) browser.mainForm.submitNew(sleep=(TMIN_SLEEP, TMAX_SLEEP)))
...@@ -40,12 +40,15 @@ def createDataStream(result, browser): ...@@ -40,12 +40,15 @@ def createDataStream(result, browser):
# Fill the title # Fill the title
my_title = PREFIX_TITLE + generateString(6) my_title = PREFIX_TITLE + generateString(6)
browser.mainForm.getControl(name='field_my_title').value = my_title browser.mainForm.getControl(name='field_my_title').value = my_title
browser.mainForm.getControl(name='field_my_reference').value = generateString(6)
# Set some random informations
my_str = generateString(random.randint(1,100)) my_str = generateString(random.randint(1,100))
browser.mainForm.getControl(name='field_my_description').value = my_str browser.mainForm.getControl(name='field_my_description').value = my_str
result('Save',
browser.mainForm.submitSave(sleep=(TMIN_SLEEP, TMAX_SLEEP)))
# XXX: how to upload data? # tests upload data from file of 1Mb size
ctrl = browser.mainForm.getControl(name='field_my_file')
ctrl.add_file(io.BytesIO(generateString(1024)*1024), 'text/plain', 'test.txt')
# Submit the changes, record the time elapsed in seconds # Submit the changes, record the time elapsed in seconds
result('Save', result('Save',
...@@ -53,10 +56,10 @@ def createDataStream(result, browser): ...@@ -53,10 +56,10 @@ def createDataStream(result, browser):
# Check whether the changes have been successfully updated # Check whether the changes have been successfully updated
assert browser.getTransitionMessage() == 'Data updated.' assert browser.getTransitionMessage() == 'Data updated.'
sale_order_url = my_order_sale_url
# Validate the Data Stream # Validate the Data Stream
#browser.mainForm.submitSelectWorkflow(value='validate_action') #browser.mainForm.submitSelectWorkflow(value='validate_action')
#result('Validate', #result('Validate',
# browser.mainForm.submitDialogConfirm(sleep=(TMIN_SLEEP, TMAX_SLEEP))) # browser.mainForm.submitDialogConfirm(sleep=(TMIN_SLEEP, TMAX_SLEEP)))
#assert browser.getTransitionMessage() == 'Status changed.' #assert browser.getTransitionMessage() == 'Status changed.'
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