tests/abiquo_postinst_test.rb in abiquo-installer-tests-0.2.4 vs tests/abiquo_postinst_test.rb in abiquo-installer-tests-20120104

- old
+ new

@@ -25,10 +25,15 @@ def self.service_on?(service) ENV['LANG'] = 'POSIX' `/sbin/chkconfig --list #{service}` =~ /3:on/ end + def self.web_service_auth_required?(path, host = 'localhost') + res = Net::HTTP.get_response URI.parse("http://#{host}/#{path}") + return res.is_a? Net::HTTPUnauthorized + end + def self.web_service_ok?(path, host = 'localhost') res = Net::HTTP.get_response URI.parse("http://#{host}/#{path}") return res.is_a? Net::HTTPOK end @@ -37,10 +42,18 @@ buf = File.read '/etc/abiquo-release' buf =~ /Version:\s*(([0-9]|\.)+).*$/ $1 end + def self.abiquo_base_dir + "/opt/abiquo" + end + + def self.webapp_deployed?(webapp) + File.directory? "#{abiquo_base_dir}/tomcat/webapps/#{webapp}" + end + end class BaseTest < Test::Unit::TestCase def test_etk_present @@ -68,9 +81,10 @@ $stderr.puts "Can't continue testing :(" $stderr.puts "" exit 1 else + $stdout.sync = true version = TestUtils.abiquo_version $: << version if version.nil? puts "Can't find Abiquo Version in /etc/abiquo-release" exit 1