diff options
author | Luke Kanies <luke@madstop.com> | 2005-05-30 01:16:19 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2005-05-30 01:16:19 +0000 |
commit | b46135f84cefbc28d41dc6c4da42b93e08da8648 (patch) | |
tree | 10761fa3991db274e8f675842b205ec640ab469c | |
parent | 7fecad310828d120769972ba6112737fbaa10fd5 (diff) | |
download | puppet-b46135f84cefbc28d41dc6c4da42b93e08da8648.tar.gz puppet-b46135f84cefbc28d41dc6c4da42b93e08da8648.tar.xz puppet-b46135f84cefbc28d41dc6c4da42b93e08da8648.zip |
adding simple query syntax stuff
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@281 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r-- | test/types/tc_query.rb | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/test/types/tc_query.rb b/test/types/tc_query.rb new file mode 100644 index 000000000..39c61c8c8 --- /dev/null +++ b/test/types/tc_query.rb @@ -0,0 +1,101 @@ +if __FILE__ == $0 + $:.unshift '..' + $:.unshift '../../lib' + $blinkbase = "../../../../language/trunk" +end + +require 'blink' +require 'test/unit' + +# $Id$ + +class TestBasic < Test::Unit::TestCase + def setup + Blink[:debug] = true + end + + # hmmm + # this is complicated, because we store references to the created + # objects in a central store + def file + assert_nothing_raised() { + cfile = File.join($blinkbase,"examples/root/etc/configfile") + unless Blink::Type::File.has_key?(cfile) + Blink::Type::File.new( + :path => cfile, + :check => [:mode, :owner, :group] + ) + end + @configfile = Blink::Type::File[cfile] + } + return @configfile + end + + def service + assert_nothing_raised() { + unless Blink::Type::Service.has_key?("sleeper") + Blink::Type::Service.new( + :name => "sleeper", + :check => [:running] + ) + Blink::Type::Service.setpath( + File.join($blinkbase,"examples/root/etc/init.d") + ) + end + @sleeper = Blink::Type::Service["sleeper"] + } + + return @sleeper + end + + def component(*args) + assert_nothing_raised() { + @component = Blink::Component.new + } + + args.each { |arg| + assert_nothing_raised() { + @component.push arg + } + } + + return @component + end + + def test_file + yayfile = file() + #p yayfile + yayfile.eachstate { |state| + assert_nil(state.is) + } + + assert_nothing_raised() { + yayfile.retrieve + } + end + + def test_service + service = service() + service.eachstate { |state| + assert_nil(state.is) + } + + assert_nothing_raised() { + service.retrieve + } + end + + def test_component + component = component(file(),service()) + + assert_nothing_raised() { + component.retrieve + } + end + + def teardown + assert_nothing_raised() { + Blink::Type.allclear + } + end +end |