Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] rest-service : branch, master, updated.
  • From: git version control <git@xxxxxxxxxxxxxxxx>
  • Date: Thu, 02 Jul 2009 15:50:02 +0200
  • Message-id: <E1MMMfq-00024u-EU@xxxxxxxxxxxxxxxx>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "YaST web service".

The branch, master has been updated
via 609660883c049471d8c5e23ed4c50eb55991fe2b (commit)
from 58bc65543fc9d6238c2beade79723283d69918dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 609660883c049471d8c5e23ed4c50eb55991fe2b
Author: Josef Reidinger <jreidinger@xxxxxxx>
Date: Thu Jul 2 15:57:15 2009 +0200

"don't forget add test file :)"*50

-----------------------------------------------------------------------

Summary of changes and diff:
plugins/time/test/unit/systemtime_test.rb | 123 +++++++++++++++++++++++++++++
1 files changed, 123 insertions(+), 0 deletions(-)
create mode 100644 plugins/time/test/unit/systemtime_test.rb

diff --git a/plugins/time/test/unit/systemtime_test.rb
b/plugins/time/test/unit/systemtime_test.rb
new file mode 100644
index 0000000..834caca
--- /dev/null
+++ b/plugins/time/test/unit/systemtime_test.rb
@@ -0,0 +1,123 @@
+require 'test_helper'
+
+
+
+class LanguageTest < ActiveSupport::TestCase
+
+ Test_timezones = [{
+ "name" => "Europe",
+ "central" => "Europe/Prague",
+ "entries" => {
+ "Europe/Prague" => "Czech Republic",
+ "Europe/Kiev" => "Ukraine (Kiev)"
+ }
+ },
+ {
+ "name" => "USA",
+ "central" => "America/Chicago",
+ "entries" => {
+ "America/Chicago" => "Central (Chicago)",
+ "America/Kentucky/Monticello" => "Kentucky (Monticello)"
+ }
+ }
+ ]
+
+ def read_arguments
+ return {
+ "zones"=> "true",
+ "timezone"=> "true",
+ "utcstatus"=> "true",
+ "currenttime" => "true"
+ }
+ end
+
+ def read_response
+ return {
+ "zones"=> Test_timezones,
+ "timezone"=> "Europe/Prague",
+ "utcstatus"=> "true",
+ "time" => "2009-07-02 - 12:18:00"
+ }
+ end
+
+ def write_arguments
+ return {
+ "timezone"=> "America/Kentucky/Monticello",
+ "utcstatus"=> "false"
+ }
+ end
+
+ def setup
+ @model = Systemtime.new
+ end
+
+
+ def test_getter
+ result = read_response
+
YastService.stubs(:Call).with("YaPI::TIME::Read",read_arguments).returns(result)
+
+ @model.read
+ assert_equal(result["time"], @model.datetime)
+ assert_equal("Europe/Prague", @model.timezone)
+ assert_equal("true", @model.utcstatus)
+ assert_equal(Test_timezones,@model.timezones)
+ end
+
+ def test_setter
+
YastService.stubs(:Call).with("YaPI::TIME::Write",write_arguments).returns(true)
+ YastService.expects(:Call).once
+
+ @model.timezone = "Europe/Prague"
+ @model.utcstatus = "false"
+ @model.save
+ end
+
+ def test_xml
+ #inject Timezones to set available timezone for direct testing
+ def @model.timezones=(val)
+ @@timezones=val
+ end
+
+ data = read_response
+ @model.timezone = data["timezone"]
+ @model.utcstatus = data["utcstatus"]
+ @model.datetime = data["currenttime"]
+ @model.timezones = Test_timezones
+
+ response = Hash.from_xml(@model.to_xml)
+ response = response["systemtime"]
+
+ assert_equal(data["timezone"], response["timezone"])
+ assert_equal(data["utcstatus"], response["utcstatus"])
+ assert_equal(data["currenttime"], response["time"])
+
+ zone_response = Test_timezones
+ zone_response.each { |zone|
+ entries = []
+ zone["entries"].each { |k,v|
+ entries.push({"id"=>k,"name"=>v})
+ }
+ zone["entries"] = entries
+ }
+
+ assert_equal(zone_response.sort { |a,b| a["name"] <=> b["name"] },
+ response["timezones"].sort { |a,b| a["name"] <=> b["name"] })
+ end
+
+ def test_json
+ #inject Timezones to set available timezone for direct testing
+ def @model.timezones=(val)
+ @@timezones=val
+ end
+
+
+ data = read_response
+ @model.timezone = data["timezone"]
+ @model.utcstatus = data["utcstatus"]
+ @model.datetime = data["currenttime"]
+ @model.timezones = Test_timezones
+
+ assert_not_nil(@model.to_json)
+ end
+
+end


hooks/post-receive
--
YaST web service
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >