ref: refs/heads/dmacvicar_log_viewer commit 9cd593f0086b52dfefd23d9c24f17864647038e2 Author: Stefan Schubert <schubi@suse.de> Date: Mon Aug 17 18:59:55 2009 +0200 rake test:ui TEST=test/ui/permission_test.rb .... runs selenium together with sinatra --- webclient/lib/tasks/selenium.rake | 14 +++- webclient/test/dummy-host/README | 2 +- webclient/test/dummy-host/dummy-host.rb | 153 ------------------------------- webclient/test/dummy-host/host.rb | 153 +++++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+), 156 deletions(-) diff --git a/webclient/lib/tasks/selenium.rake b/webclient/lib/tasks/selenium.rake index 563978d..0cb4c62 100644 --- a/webclient/lib/tasks/selenium.rake +++ b/webclient/lib/tasks/selenium.rake @@ -1,4 +1,3 @@ - $selenium_available = false begin @@ -26,6 +25,17 @@ rescue LoadError puts "Selenium not available" end +namespace :sinatra do + task :start do + cmd = "ruby #{File.join(File.dirname(__FILE__),"../..", "test/dummy-host/host.rb")} &" + system cmd + end + task :stop do + system "ps a|grep dummy-host/host.rb|cut -c -6 | xargs kill -9" + end +end + + namespace :test do # define test:ui:check task Rake::TestTask.new(:"ui:check") do |t| @@ -51,7 +61,7 @@ namespace :test do exit 1 end else - task :ui => [:"selenium:rc:start", :"test:ui:check", :"selenium:rc:stop"] + task :ui => [:"sinatra:start", :"selenium:rc:start", :"test:ui:check", :"selenium:rc:stop", :"sinatra:stop"] end end diff --git a/webclient/test/dummy-host/README b/webclient/test/dummy-host/README index ad72981..f565ad6 100644 --- a/webclient/test/dummy-host/README +++ b/webclient/test/dummy-host/README @@ -1,7 +1,7 @@ His is an emulation of the webYaST REST interface by using "sinatra" (http://www.sinatrarb.com/) -Just call "ruby dummy-host.rb" in order to start the REST servive. +Just call "ruby host.rb" in order to start the REST servive. Then you have access to the URL: diff --git a/webclient/test/dummy-host/dummy-host.rb b/webclient/test/dummy-host/dummy-host.rb deleted file mode 100644 index 9a1ea2c..0000000 --- a/webclient/test/dummy-host/dummy-host.rb +++ /dev/null @@ -1,153 +0,0 @@ -# dummy-host.rb - require 'rubygems' - require 'active_support' - require 'sinatra' - - post '/login.xml' do - login = Hash.new - login["login"] = "granted" - login["auth_token"] = {"expires"=>"Tue Aug 18 07:08:22 UTC 2009", "value"=>"3e3910533595dd5657c54c32f27fc6068df96873"} - login.to_xml - end - - post '/logout.xml' do - logout = Hash.new - logout["logout"] = "Goodbye!" - logout.to_xml - end - - get '/resources.xml' do - resources = [{"interface" => "org.opensuse.yast.modules.yapi.time", - "singular" => true, - "href" => "time"}, - {"interface" => "org.opensuse.yast.modules.yapi.users", - "singular" => true, - "href" => "users"}, - {"interface" => "org.opensuse.yast.modules.yapi.language", - "singular" => true, - "href" => "language"}, - {"interface" => "org.opensuse.yast.system.services", - "singular" => true, - "href" => "services"}, - {"interface" => "org.opensuse.yast.system.patches", - "singular" => true, - "href" => "patches"}, - {"interface" => "org.opensuse.yast.system.security", - "singular" => true, - "href" => "security"}, - {"interface" => "org.opensuse.yast.system.networks", - "singular" => true, - "href" => "networks"}, - {"interface" => "org.opensuse.yast.system.sambashares", - "singular" => true, - "href" => "sambashares"}, - {"interface" => "org.opensuse.yast.system.system", - "singular" => true, - "href" => "system"}, - {"interface" => "org.opensuse.yast.system.status", - "singular" => true, - "href" => "status"}, - {"interface" => "org.opensuse.yast.commandline", - "singular" => true, - "href" => "yast/commandline"}] - resources.to_xml(:root => "resources") - end - - get '/permissions.xml' do - permissions = [ {"name" => "org.opensuse.yast.webservice.read-permissions", "grant" => true}, - {"name" => "org.opensuse.yast.webservice.write-permissions", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.language.setcurrentlanguage", "grant" => true}, - {"name" =>"org.opensuse.yast.system.network.read", "grant" => true}, - {"name" =>"org.opensuse.yast.language.read-firstlanguage", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.error", "grant" => false}, - {"name" =>"org.opensuse.yast.services.execute-commands-gpm", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.registeragent", "grant" => false}, - {"name" =>"org.opensuse.yast.language.read", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.write-timezone", "grant" => true}, - {"name" =>"org.opensuse.yast.services.read-config-ntp-manualserver", "grant" => true}, - {"name" =>"org.opensuse.yast.system.services.execute", "grant" => true}, - {"name" =>"org.opensuse.yast.system.users.write", "grant" => true}, - {"name" =>"org.opensuse.yast.services.write-config", "grant" => true}, - {"name" =>"org.opensuse.yast.system.users.delete", "grant" => true}, - {"name" =>"org.opensuse.yast.system.patches.read", "grant" => true}, - {"name" =>"org.opensuse.yast.system.time.read", "grant" => true}, - {"name" =>"org.opensuse.yast.language.read-secondlanguages", "grant" => true}, - {"name" =>"org.opensuse.yast.services.read", "grant" => true}, - {"name" =>"org.opensuse.yast.system.users.read", "grant" => true}, - {"name" =>"org.opensuse.yast.system.patches.install", "grant" => true}, - {"name" =>"org.opensuse.yast.permissions.write", "grant" => true}, - {"name" =>"org.opensuse.yast.language.write", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.users.useradd", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.unregisteragent", "grant" => false}, - {"name" =>"org.opensuse.yast.services.read-config-ntp-enabled", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.execute", "grant" => false}, - {"name" =>"org.opensuse.yast.modules.yapi.language.setutf8", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.unregisterallagents", "grant" => false}, - {"name" =>"org.opensuse.yast.services.write-config-ntp", "grant" => true}, - {"name" =>"org.opensuse.yast.module-manager.import", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.time.write", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.dir", "grant" => false}, - {"name" =>"org.opensuse.yast.modules.yapi.language.getlanguages", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.write", "grant" => true}, - {"name" =>"org.opensuse.yast.system.status.writelimits", "grant" => true}, - {"name" =>"org.opensuse.yast.system.time.write", "grant" => true}, - {"name" =>"org.opensuse.yast.language.read-available", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands-random", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.users.usersget", "grant" => true}, - {"name" =>"org.opensuse.yast.system.security.write", "grant" => true}, - {"name" =>"org.opensuse.yast.permissions.read", "grant" => true}, - {"name" =>"org.opensuse.yast.system.services.read", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands-ntp", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands-smbfs", "grant" => true}, - {"name" =>"org.opensuse.yast.services.write-config-ntp-enabled", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.read", "grant" => false}, - {"name" =>"org.opensuse.yast.modules.yapi.language.getcurrentlanguage", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.read", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.time.read", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.write", "grant" => false}, - {"name" =>"org.opensuse.yast.patch.install", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.language.isutf8", "grant" => true}, - {"name" =>"org.opensuse.yast.system.services.write", "grant" => true}, - {"name" =>"org.opensuse.yast.services.write-config-ntp-manualserver", "grant" => true}, - {"name" =>"org.opensuse.yast.system.language.read", "grant" => true}, - {"name" =>"org.opensuse.yast.services.write", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.registernewagents", "grant" => false}, - {"name" =>"org.opensuse.yast.language.write-secondlanguages", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.language.write", "grant" => true}, - {"name" =>"org.opensuse.yast.system.status.read", "grant" => true}, - {"name" =>"org.opensuse.yast.system.users.new", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands-sshd", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.read-validtimezones", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.read-isutc", "grant" => true}, - {"name" =>"org.opensuse.yast.scr.unmountagent", "grant" => false}, - {"name" =>"org.opensuse.yast.language.write-firstlanguage", "grant" => true}, - {"name" =>"org.opensuse.yast.module-manager.lock", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.users.userdelete", "grant" => true}, - {"name" =>"org.opensuse.yast.services.read-config-ntp-userandomserverw", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.language.setrootlang", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.language.read", "grant" => true}, - {"name" =>"org.opensuse.yast.system.network.writelimits", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.write-isutc", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.write-currenttime", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.users.userget", "grant" => true}, - {"name" =>"org.opensuse.yast.patch.read", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands-cups", "grant" => true}, - {"name" =>"org.opensuse.yast.system.security.read", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.read-currenttime", "grant" => true}, - {"name" =>"org.opensuse.yast.system.language.write", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.language.getrootlang", "grant" => true}, - {"name" =>"org.opensuse.yast.systemtime.read-timezone", "grant" => true}, - {"name" =>"org.opensuse.yast.services.execute-commands-cron", "grant" => true}, - {"name" =>"org.opensuse.yast.services.read-config-ntp", "grant" => true}, - {"name" =>"org.opensuse.yast.services.write-config-ntp-userandomserverw", "grant" => true}, - {"name" =>"org.opensuse.yast.services.read-config", "grant" => true}, - {"name" =>"org.opensuse.yast.modules.yapi.users.usermodify", "grant" => true}] - permissions.to_xml(:root => "permissions") - end - - put '/permissions/:id.xml' do - permission = {"name" => "org.opensuse.yast.webservice.return-permissions", "grant" => true} - permission.to_xml(:root => "permission") - end \ No newline at end of file diff --git a/webclient/test/dummy-host/host.rb b/webclient/test/dummy-host/host.rb new file mode 100644 index 0000000..1729ad0 --- /dev/null +++ b/webclient/test/dummy-host/host.rb @@ -0,0 +1,153 @@ +# host.rb + require 'rubygems' + require 'active_support' + require 'sinatra' + + post '/login.xml' do + login = Hash.new + login["login"] = "granted" + login["auth_token"] = {"expires"=>"Tue Aug 18 07:08:22 UTC 2009", "value"=>"3e3910533595dd5657c54c32f27fc6068df96873"} + login.to_xml + end + + post '/logout.xml' do + logout = Hash.new + logout["logout"] = "Goodbye!" + logout.to_xml + end + + get '/resources.xml' do + resources = [{"interface" => "org.opensuse.yast.modules.yapi.time", + "singular" => true, + "href" => "time"}, + {"interface" => "org.opensuse.yast.modules.yapi.users", + "singular" => true, + "href" => "users"}, + {"interface" => "org.opensuse.yast.modules.yapi.language", + "singular" => true, + "href" => "language"}, + {"interface" => "org.opensuse.yast.system.services", + "singular" => true, + "href" => "services"}, + {"interface" => "org.opensuse.yast.system.patches", + "singular" => true, + "href" => "patches"}, + {"interface" => "org.opensuse.yast.system.security", + "singular" => true, + "href" => "security"}, + {"interface" => "org.opensuse.yast.system.networks", + "singular" => true, + "href" => "networks"}, + {"interface" => "org.opensuse.yast.system.sambashares", + "singular" => true, + "href" => "sambashares"}, + {"interface" => "org.opensuse.yast.system.system", + "singular" => true, + "href" => "system"}, + {"interface" => "org.opensuse.yast.system.status", + "singular" => true, + "href" => "status"}, + {"interface" => "org.opensuse.yast.commandline", + "singular" => true, + "href" => "yast/commandline"}] + resources.to_xml(:root => "resources") + end + + get '/permissions.xml' do + permissions = [ {"name" => "org.opensuse.yast.webservice.read-permissions", "grant" => true}, + {"name" => "org.opensuse.yast.webservice.write-permissions", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.language.setcurrentlanguage", "grant" => true}, + {"name" =>"org.opensuse.yast.system.network.read", "grant" => true}, + {"name" =>"org.opensuse.yast.language.read-firstlanguage", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.error", "grant" => false}, + {"name" =>"org.opensuse.yast.services.execute-commands-gpm", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.registeragent", "grant" => false}, + {"name" =>"org.opensuse.yast.language.read", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.write-timezone", "grant" => true}, + {"name" =>"org.opensuse.yast.services.read-config-ntp-manualserver", "grant" => true}, + {"name" =>"org.opensuse.yast.system.services.execute", "grant" => true}, + {"name" =>"org.opensuse.yast.system.users.write", "grant" => true}, + {"name" =>"org.opensuse.yast.services.write-config", "grant" => true}, + {"name" =>"org.opensuse.yast.system.users.delete", "grant" => true}, + {"name" =>"org.opensuse.yast.system.patches.read", "grant" => true}, + {"name" =>"org.opensuse.yast.system.time.read", "grant" => true}, + {"name" =>"org.opensuse.yast.language.read-secondlanguages", "grant" => true}, + {"name" =>"org.opensuse.yast.services.read", "grant" => true}, + {"name" =>"org.opensuse.yast.system.users.read", "grant" => true}, + {"name" =>"org.opensuse.yast.system.patches.install", "grant" => true}, + {"name" =>"org.opensuse.yast.permissions.write", "grant" => true}, + {"name" =>"org.opensuse.yast.language.write", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.users.useradd", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.unregisteragent", "grant" => false}, + {"name" =>"org.opensuse.yast.services.read-config-ntp-enabled", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.execute", "grant" => false}, + {"name" =>"org.opensuse.yast.modules.yapi.language.setutf8", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.unregisterallagents", "grant" => false}, + {"name" =>"org.opensuse.yast.services.write-config-ntp", "grant" => true}, + {"name" =>"org.opensuse.yast.module-manager.import", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.time.write", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.dir", "grant" => false}, + {"name" =>"org.opensuse.yast.modules.yapi.language.getlanguages", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.write", "grant" => true}, + {"name" =>"org.opensuse.yast.system.status.writelimits", "grant" => true}, + {"name" =>"org.opensuse.yast.system.time.write", "grant" => true}, + {"name" =>"org.opensuse.yast.language.read-available", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands-random", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.users.usersget", "grant" => true}, + {"name" =>"org.opensuse.yast.system.security.write", "grant" => true}, + {"name" =>"org.opensuse.yast.permissions.read", "grant" => true}, + {"name" =>"org.opensuse.yast.system.services.read", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands-ntp", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands-smbfs", "grant" => true}, + {"name" =>"org.opensuse.yast.services.write-config-ntp-enabled", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.read", "grant" => false}, + {"name" =>"org.opensuse.yast.modules.yapi.language.getcurrentlanguage", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.read", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.time.read", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.write", "grant" => false}, + {"name" =>"org.opensuse.yast.patch.install", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.language.isutf8", "grant" => true}, + {"name" =>"org.opensuse.yast.system.services.write", "grant" => true}, + {"name" =>"org.opensuse.yast.services.write-config-ntp-manualserver", "grant" => true}, + {"name" =>"org.opensuse.yast.system.language.read", "grant" => true}, + {"name" =>"org.opensuse.yast.services.write", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.registernewagents", "grant" => false}, + {"name" =>"org.opensuse.yast.language.write-secondlanguages", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.language.write", "grant" => true}, + {"name" =>"org.opensuse.yast.system.status.read", "grant" => true}, + {"name" =>"org.opensuse.yast.system.users.new", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands-sshd", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.read-validtimezones", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.read-isutc", "grant" => true}, + {"name" =>"org.opensuse.yast.scr.unmountagent", "grant" => false}, + {"name" =>"org.opensuse.yast.language.write-firstlanguage", "grant" => true}, + {"name" =>"org.opensuse.yast.module-manager.lock", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.users.userdelete", "grant" => true}, + {"name" =>"org.opensuse.yast.services.read-config-ntp-userandomserverw", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.language.setrootlang", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.language.read", "grant" => true}, + {"name" =>"org.opensuse.yast.system.network.writelimits", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.write-isutc", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.write-currenttime", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.users.userget", "grant" => true}, + {"name" =>"org.opensuse.yast.patch.read", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands-cups", "grant" => true}, + {"name" =>"org.opensuse.yast.system.security.read", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.read-currenttime", "grant" => true}, + {"name" =>"org.opensuse.yast.system.language.write", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.language.getrootlang", "grant" => true}, + {"name" =>"org.opensuse.yast.systemtime.read-timezone", "grant" => true}, + {"name" =>"org.opensuse.yast.services.execute-commands-cron", "grant" => true}, + {"name" =>"org.opensuse.yast.services.read-config-ntp", "grant" => true}, + {"name" =>"org.opensuse.yast.services.write-config-ntp-userandomserverw", "grant" => true}, + {"name" =>"org.opensuse.yast.services.read-config", "grant" => true}, + {"name" =>"org.opensuse.yast.modules.yapi.users.usermodify", "grant" => true}] + permissions.to_xml(:root => "permissions") + end + + put '/permissions/:id.xml' do + permission = {"name" => "org.opensuse.yast.webservice.return-permissions", "grant" => true} + permission.to_xml(:root => "permission") + end \ No newline at end of file -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org