Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <web-client> basesystem : added ui testcase for permission and dummy REST service
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Mon, 24 Aug 2009 15:37:52 +0200
  • Message-id: <E1MlexU-0003VR-Hw@xxxxxxxxxxxxxxxx>
ref: refs/heads/basesystem
commit 7ae3f1740973cb9e54e1e64f50c3b4e3e026fc62
Author: Stefan Schubert <schubi@xxxxxxx>
Date: Mon Aug 17 14:16:36 2009 +0200

added ui testcase for permission and dummy REST service
---
webclient/test/dummy-host/README | 8 ++
webclient/test/dummy-host/dummy-host.rb | 153 +++++++++++++++++++++++++++++
webclient/test/ui/permission_test.rb | 27 +++++
webclient/test/ui/src/permission_test.xml | 77 +++++++++++++++
4 files changed, 265 insertions(+), 0 deletions(-)

diff --git a/webclient/test/dummy-host/README b/webclient/test/dummy-host/README
new file mode 100644
index 0000000..ad72981
--- /dev/null
+++ b/webclient/test/dummy-host/README
@@ -0,0 +1,8 @@
+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.
+
+Then you have access to the URL:
+
+http://localhost:4567
\ No newline at end of file
diff --git a/webclient/test/dummy-host/dummy-host.rb
b/webclient/test/dummy-host/dummy-host.rb
new file mode 100644
index 0000000..9a1ea2c
--- /dev/null
+++ b/webclient/test/dummy-host/dummy-host.rb
@@ -0,0 +1,153 @@
+# 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/ui/permission_test.rb
b/webclient/test/ui/permission_test.rb
new file mode 100644
index 0000000..076545d
--- /dev/null
+++ b/webclient/test/ui/permission_test.rb
@@ -0,0 +1,27 @@
+# Generated by ruby-webyast-0.1 Selenium formatter
+# Date: Mon Aug 17 2009 14:00:00 GMT+0200 (CEST)
+
+require "selenium/test_case"
+
+class Permission_test < Selenium::TestCase
+
+ def test_permission_test
+ @selenium.open "/permissions"
+ @selenium.click "link=dummy-host"
+ @selenium.wait_for_page_to_load "30000"
+ @selenium.type "login", "schubi"
+ @selenium.type "password", "tes"
+ @selenium.click "login_button"
+ @selenium.wait_for_page_to_load "30000"
+ @selenium.type "user", "schubi"
+ @selenium.click "commit"
+ @selenium.wait_for_page_to_load "30000"
+ @selenium.click
"//div[@id='content']/div[4]/form/form/table/tbody/tr[2]/td[2]/ul/ul/li[9]/div[1]"
+ @selenium.click
"//div[@id='content']/div[4]/form/form/table/tbody/tr[2]/td[2]/ul/ul/li[9]/ul/li[2]/div[2]"
+ @selenium.click "org.opensuse.yast.patch.install"
+ @selenium.click "//input[@name='commit' and @value='Set']"
+ @selenium.wait_for_page_to_load "30000"
+ @selenium.click "//a[contains(@href, '/logout')]"
+ @selenium.wait_for_page_to_load "30000"
+ end
+end
diff --git a/webclient/test/ui/src/permission_test.xml
b/webclient/test/ui/src/permission_test.xml
new file mode 100644
index 0000000..797c6ad
--- /dev/null
+++ b/webclient/test/ui/src/permission_test.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case";>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>Permission_test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Permission_test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/permissions</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=dummy-host</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>login</td>
+ <td>schubi</td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>password</td>
+ <td>tes</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>login_button</td>
+ <td></td>
+</tr>
+<tr>
+ <td>type</td>
+ <td>user</td>
+ <td>schubi</td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>commit</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+
<td>//div[@id='content']/div[4]/form/form/table/tbody/tr[2]/td[2]/ul/ul/li[9]/div[1]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+
<td>//div[@id='content']/div[4]/form/form/table/tbody/tr[2]/td[2]/ul/ul/li[9]/ul/li[2]/div[2]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>org.opensuse.yast.patch.install</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//input[@name='commit' and @value='Set']</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//a[contains(@href, '/logout')]</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages