summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormguetlein <martin.guetlein@gmail.com>2011-05-09 16:31:29 +0200
committermguetlein <martin.guetlein@gmail.com>2011-05-09 16:31:29 +0200
commitd798101491309cd65b0d49ed2993d439a74d7c5e (patch)
tree32b285241376da9fec17b0fbd8c50e048d6574d4 /lib
parente09012e01aa865900184bee186933b11f6fa1d3f (diff)
remove unit tests from validation repository (move to test)
Diffstat (limited to 'lib')
-rwxr-xr-xlib/test_util.rb76
1 files changed, 0 insertions, 76 deletions
diff --git a/lib/test_util.rb b/lib/test_util.rb
deleted file mode 100755
index 590d295..0000000
--- a/lib/test_util.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-
-require 'test/unit'
-
-module Lib
- # test utitily, to be included rack unit tests
- module TestUtil
-
- def wait_for_task(uri)
- return TestUtil.wait_for_task(uri)
- end
-
- def self.wait_for_task(uri)
- if uri.task_uri?
- task = OpenTox::Task.find(uri)
- task.wait_for_completion
- #raise "task failed: "+uri.to_s+", error is:\n"+task.description if task.error?
- LOGGER.error "task failed :\n"+task.to_yaml if task.error?
- uri = task.result_uri
- end
- return uri
- end
-
- # updloads a dataset
- def upload_data(ws, file)
-
- case file.path
- when /yaml$/
- type = "application/x-yaml"
- when /owl$/
- type = "application/rdf+xml"
- else
- raise "unknown type for file: "+file.path.to_s
- end
-
- data = File.read(file.path)
- task_uri = RestClient.post ws, data, :content_type => type
- data_uri = task_uri.body
- puts "done: "+data_uri.to_s
- add_resource(data_uri)
- return data_uri
- end
-
- # adds a resource to delete it later on
- def add_resource(res)
- @to_delete = [] unless @to_delete
- @to_delete.push(res)
- end
-
- # deletes all resources
- def delete_resources
- if @to_delete
- @to_delete.each do |d|
- puts "deleting "+d.to_s
- if d.to_s =~ /^http.*/
- ext("curl -X DELETE "+d.to_s)
- else
- delete d.to_s
- end
- end
- end
- end
-
- # execute an external program like curl
- def ext(call, indent=" ")
- response = ""
- IO.popen(call.to_s+" 2> /dev/null") do |f|
- while line = f.gets
- response += indent.to_s+line
- end
- end
- assert $?==0, "returns error "+call+" "+response
- return response
- end
-
- end
-end