mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Functionally test various upload options via API.
This commit is contained in:
@@ -33,6 +33,27 @@ class ToolsTestCase( api.ApiTestCase ):
|
||||
create_response = self._post( "tools", data=payload )
|
||||
self._assert_has_keys( create_response.json(), 'outputs' )
|
||||
|
||||
def test_upload_posix_newline_fixes( self ):
|
||||
windows_content = "1\t2\t3\r4\t5\t6\r"
|
||||
posix_content = windows_content.replace("\r", "\n")
|
||||
result_content = self._upload_and_get_content( windows_content )
|
||||
self.assertEquals( result_content, posix_content )
|
||||
|
||||
def test_upload_disable_posix_fix( self ):
|
||||
windows_content = "1\t2\t3\r4\t5\t6\r"
|
||||
result_content = self._upload_and_get_content( windows_content, to_posix_lines=None )
|
||||
self.assertEquals( result_content, windows_content )
|
||||
|
||||
def test_upload_tab_to_space( self ):
|
||||
table = "1 2 3\n4 5 6\n"
|
||||
result_content = self._upload_and_get_content( table, space_to_tab="Yes" )
|
||||
self.assertEquals( result_content, "1\t2\t3\n4\t5\t6\n" )
|
||||
|
||||
def test_upload_tab_to_space_off_by_default( self ):
|
||||
table = "1 2 3\n4 5 6\n"
|
||||
result_content = self._upload_and_get_content( table )
|
||||
self.assertEquals( result_content, table )
|
||||
|
||||
def test_run_cat1( self ):
|
||||
history_id = self._new_history()
|
||||
new_dataset = self._new_dataset( history_id )
|
||||
@@ -52,6 +73,14 @@ class ToolsTestCase( api.ApiTestCase ):
|
||||
self._assert_has_keys( create_response.json(), 'outputs' )
|
||||
self._wait_for_history( history_id, assert_ok=True )
|
||||
|
||||
def _upload_and_get_content( self, content, **upload_kwds ):
|
||||
history_id = self._new_history()
|
||||
new_dataset = self._new_dataset( history_id, content=content, **upload_kwds )
|
||||
self._wait_for_history( history_id, assert_ok=True )
|
||||
display_response = self._get( "histories/%s/contents/%s/display" % ( history_id, new_dataset[ "id" ] ) )
|
||||
self._assert_status_code_is( display_response, 200 )
|
||||
return display_response.content
|
||||
|
||||
def _new_dataset( self, history_id, content='TestData123', **kwds ):
|
||||
payload = self._upload_payload( history_id, content, **kwds )
|
||||
run_response = self._post( "tools", data=payload )
|
||||
@@ -86,6 +115,10 @@ class ToolsTestCase( api.ApiTestCase ):
|
||||
'dbkey': dbkey,
|
||||
'file_type': file_type,
|
||||
}
|
||||
if "to_posix_lines" in kwds:
|
||||
upload_params[ "files_0|to_posix_lines"] = kwds[ "to_posix_lines" ]
|
||||
if "space_to_tab" in kwds:
|
||||
upload_params[ "files_0|space_to_tab" ] = kwds[ "space_to_tab" ]
|
||||
return self._run_tool_payload(
|
||||
tool_id='upload1',
|
||||
inputs=upload_params,
|
||||
|
||||
Reference in New Issue
Block a user