Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <rest-service> master : Test for Permission class
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Thu, 9 Jul 2009 11:31:47 +0200
  • Message-id: <E1MOtHA-0007yp-SE@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit cf1188accfbb3ce06a41973b683ed573d3282e84
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Thu Jul 9 11:31:47 2009 +0200

Test for Permission class
---
webservice/test/unit/dummy_test.rb | 7 -----
webservice/test/unit/permission_test.rb | 39 +++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/webservice/test/unit/dummy_test.rb
b/webservice/test/unit/dummy_test.rb
deleted file mode 100644
index 17ae853..0000000
--- a/webservice/test/unit/dummy_test.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../test_helper'
-
-class DummyTest < ActiveSupport::TestCase
- def test_dummy
- assert true
- end
-end
\ No newline at end of file
diff --git a/webservice/test/unit/permission_test.rb
b/webservice/test/unit/permission_test.rb
new file mode 100644
index 0000000..6c5d370
--- /dev/null
+++ b/webservice/test/unit/permission_test.rb
@@ -0,0 +1,39 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+# Test Permission class
+
+class PermissionTest < ActiveSupport::TestCase
+ def test_create_permission
+ perm = Permission.new
+ assert perm
+ assert perm.name.empty?
+ assert !perm.grant
+ end
+ def test_create_permission_with_args
+ perm = Permission.new "foo", true
+ assert_equal perm.name, "foo"
+ assert perm.grant
+ end
+ def test_permission_to_xml
+ perm = Permission.new "foo", true
+ xml = perm.to_xml
+ assert xml
+ hash = Hash.from_xml(xml)
+ assert hash
+ perm = hash["permission"]
+ assert perm
+ assert_equal perm["name"], "foo"
+ assert perm["grant"]
+ end
+ def test_permission_to_json
+ perm = Permission.new "foo", true
+ json = perm.to_json
+ assert json
+# hash = Hash.from_json(json)
+# assert hash
+# perm = hash["permission"]
+# assert perm
+# assert_equal perm["name"], "foo"
+# assert perm["grant"]
+ end
+end
\ No newline at end of file
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages