Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <rest-service> dmacvicar_log_viewer : new tests for basesystem backend
  • From: Martin Kudlvasr <mkudlvasr@xxxxxxx>
  • Date: Tue, 18 Aug 2009 14:55:45 +0200
  • Message-id: <E1MlmpE-0005cT-4n@xxxxxxxxxxxxxxxx>
ref: refs/heads/dmacvicar_log_viewer
commit 7a36f7190b0ce3d4216e609d0dbc99ed920d23f9
Author: Martin Kudlvasr <mkudlvasr@xxxxxxx>
Date: Tue Aug 18 14:55:45 2009 +0200

new tests for basesystem backend
---
plugins/basesystem/test/unit/basesystem_test.rb | 56 +++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/plugins/basesystem/test/unit/basesystem_test.rb
b/plugins/basesystem/test/unit/basesystem_test.rb
new file mode 100644
index 0000000..5adf811
--- /dev/null
+++ b/plugins/basesystem/test/unit/basesystem_test.rb
@@ -0,0 +1,56 @@
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+$:.unshift File.join(File.dirname(__FILE__),'..','lib')
+
+require 'test/unit'
+require 'basesystem'
+
+class BasesystemTest < Test::Unit::TestCase
+
+ def setup
+ fh = File.new(Basesystem.STEPS_FILE, "r")
+ @test_steps = fh.lines.collect { |l| chomp l}.delete_if{|l| length l == 0}
+ fh.close
+ @basesystem = Basesystem.find
+ end
+
+ def teardown
+ File.delete(Basesystem.CURRENT_STEP_FILE)
+ end
+
+ def test_steps
+ assert_equal(@test_steps, @basesystem.steps)
+ end
+
+ def test_current
+ assert_equal(@basesystem.current, @test_steps[0])
+ end
+
+ def test_save
+ @basesystem.current = @test_steps[0]
+ @basesystem.save
+ @basesystem = Basesystem.find
+ assert_equal(@test_steps[0], @basesystem.current)
+ # test for save fail on invalid current step
+ @basesystem.current = "ridiculous"
+ assert(false, @basesystem.save)
+ end
+
+ def test_corrupted_current
+ fh = File.new(Basesystem.CURRENT_STEP_FILE)
+ fh << "ridiculous"
+ fh.close
+ @basesystem = Basesystem.find
+ assert_equal(@test_steps[0], @basesystem.current)
+ end
+
+ def test_to_xml
+ assert_not_nil(@basesystem.to_xml)
+ end
+
+ def test_to_json
+ assert_not_nil(@basesystem.to_json)
+ end
+
+end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages