Tool data API testing fixes.

- Add files I didn't commit previously in test/functional/tool-data/.
 - Comment out test for tool data table deletion since Dan fixed the problem of regular users running data managers through the API (https://github.com/galaxyproject/galaxy/commit/48f77dc742acf01ddbafafcc4634e69378f1f020) that I previously exploited to write the test.
This commit is contained in:
John Chilton
2015-03-02 22:36:24 -05:00
parent 0d62ee6960
commit b1f3654208
5 changed files with 32 additions and 28 deletions
+28 -28
View File
@@ -1,11 +1,6 @@
""" Tests for the tool data API.
"""
import json
from base import api
from .helpers import DatasetPopulator
from requests import delete
import operator
@@ -40,7 +35,7 @@ class ToolDataApiTestCase( api.ApiTestCase ):
field = show_field_response.json()
self._assert_has_keys( field, "files", "name", "fields", "fingerprint", "base_dir" )
files = field[ "files" ]
assert len( files ) == 2
assert len( files ) == 2, "Length of files [%s] was not 2." % files
def test_download_field_file(self):
show_field_response = self._get( "tool_data/testalpha/fields/data1/files/entry.txt", admin=True )
@@ -48,27 +43,32 @@ class ToolDataApiTestCase( api.ApiTestCase ):
content = show_field_response.content
assert content == "This is data 1.", content
def test_delete_entry(self):
show_response = self._get( "tool_data/testbeta", admin=True )
original_count = len(show_response.json()["fields"])
# Following test case rendered invalid by the fix in
# https://github.com/galaxyproject/galaxy/commit/48f77dc742acf01ddbafafcc4634e69378f1f020#diff-bfb557a99c1f7d646d4968d8d680b885R154.
# TODO: Restore the test case when test framework allows actions from
# admin users.
dataset_populator = DatasetPopulator( self.galaxy_interactor )
history_id = dataset_populator.new_history()
payload = dataset_populator.run_tool_payload(
tool_id="data_manager",
inputs={"ignored_value": "moo"},
history_id=history_id,
)
create_response = self._post( "tools", data=payload )
self._assert_status_code_is( create_response, 200 )
dataset_populator.wait_for_history( history_id, assert_ok=True )
show_response = self._get( "tool_data/testbeta", admin=True )
updated_fields = show_response.json()["fields"]
assert len(updated_fields) == original_count + 1
field0 = updated_fields[0]
url = self._api_url( "tool_data/testbeta?key=%s" % self.galaxy_interactor.master_api_key )
delete( url, data=json.dumps({"values": "\t".join(field0)}) )
# def test_delete_entry(self):
# show_response = self._get( "tool_data/testbeta", admin=True )
# original_count = len(show_response.json()["fields"])
show_response = self._get( "tool_data/testbeta", admin=True )
updated_fields = show_response.json()["fields"]
assert len(updated_fields) == original_count
# dataset_populator = DatasetPopulator( self.galaxy_interactor )
# history_id = dataset_populator.new_history()
# payload = dataset_populator.run_tool_payload(
# tool_id="data_manager",
# inputs={"ignored_value": "moo"},
# history_id=history_id,
# )
# create_response = self._post( "tools", data=payload )
# self._assert_status_code_is( create_response, 200 )
# dataset_populator.wait_for_history( history_id, assert_ok=True )
# show_response = self._get( "tool_data/testbeta", admin=True )
# updated_fields = show_response.json()["fields"]
# assert len(updated_fields) == original_count + 1
# field0 = updated_fields[0]
# url = self._api_url( "tool_data/testbeta?key=%s" % self.galaxy_interactor.master_api_key )
# delete( url, data=json.dumps({"values": "\t".join(field0)}) )
# show_response = self._get( "tool_data/testbeta", admin=True )
# updated_fields = show_response.json()["fields"]
# assert len(updated_fields) == original_count