summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-06-06 15:13:14 +0000
committerLuke Kanies <luke@madstop.com>2005-06-06 15:13:14 +0000
commit53240625be7d35dabe29a2e71d5ac99d6f996427 (patch)
tree594a182c69951b3b8f6fa88f99e0e4cc4aae412e /test
parent0dad57a29e84d510a9d530c79b12aa4fba9f334f (diff)
downloadpuppet-53240625be7d35dabe29a2e71d5ac99d6f996427.tar.gz
puppet-53240625be7d35dabe29a2e71d5ac99d6f996427.tar.xz
puppet-53240625be7d35dabe29a2e71d5ac99d6f996427.zip
adding new classes and tests
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@294 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/other/tc_state.rb60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/other/tc_state.rb b/test/other/tc_state.rb
new file mode 100644
index 000000000..ab496299e
--- /dev/null
+++ b/test/other/tc_state.rb
@@ -0,0 +1,60 @@
+if __FILE__ == $0
+ $:.unshift '..'
+ $:.unshift '../../lib'
+ $blinkbase = "../../../../language/trunk"
+end
+
+require 'blink'
+require 'test/unit'
+
+# $Id$
+
+class TestStorage < Test::Unit::TestCase
+ def setup
+ Blink[:debug] = true
+ Blink[:statefile] = "/var/tmp/blinkteststate"
+ end
+
+ def test_simple
+ state = nil
+ assert_nothing_raised {
+ Blink::Storage.load
+ }
+ assert_nothing_raised {
+ state = Blink::Storage.state(Blink::Type)
+ }
+ assert(state)
+ state["/etc/passwd"] = ["md5","9ebebe0c02445c40b9dc6871b64ee416"]
+ assert_nothing_raised {
+ Blink::Storage.store
+ }
+ assert_nothing_raised {
+ Blink::Storage.load
+ }
+ assert_equal(
+ ["md5","9ebebe0c02445c40b9dc6871b64ee416"],
+ Blink::Storage.state(Blink::Type)["/etc/passwd"]
+ )
+ end
+
+ def test_instance
+ file = nil
+ state = nil
+ assert_nothing_raised {
+ file = Blink::Type::File.new(
+ :path => "/etc/passwd"
+ )
+ }
+ assert_nothing_raised {
+ Blink::Storage.load
+ }
+ assert_nothing_raised {
+ state = Blink::Storage.state(file)
+ }
+ assert(state)
+ end
+
+ def teardown
+ system("rm -f %s" % Blink[:statefile])
+ end
+end