diff options
| author | Luke Kanies <luke@madstop.com> | 2005-04-13 21:03:12 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-04-13 21:03:12 +0000 |
| commit | 02ed7d3e670afff74a831b883964b9d0bdcf64e1 (patch) | |
| tree | 52cc6fb2259080de84749efb3acddc80ea4fb5e5 /test/objects/tc_basic.rb | |
| parent | 8bc935e28f0e6ac2b932fc32e19d1cf4de0db8f9 (diff) | |
| download | puppet-02ed7d3e670afff74a831b883964b9d0bdcf64e1.tar.gz puppet-02ed7d3e670afff74a831b883964b9d0bdcf64e1.tar.xz puppet-02ed7d3e670afff74a831b883964b9d0bdcf64e1.zip | |
reorganizing tests
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@130 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/objects/tc_basic.rb')
| -rw-r--r-- | test/objects/tc_basic.rb | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/test/objects/tc_basic.rb b/test/objects/tc_basic.rb new file mode 100644 index 000000000..f7ffbebfa --- /dev/null +++ b/test/objects/tc_basic.rb @@ -0,0 +1,93 @@ +$:.unshift '../lib' if __FILE__ == $0 # Make this library first! + +require 'blink' +require 'test/unit' + +# $Id$ + +class TestBasic < Test::Unit::TestCase + # hmmm + # this is complicated, because we store references to the created + # objects in a central store + def setup + @component = nil + @configfile = nil + @sleeper = nil + + Blink[:debug] = 1 + + assert_nothing_raised() { + unless Blink::Component.has_key?("sleeper") + Blink::Component.new( + :name => "sleeper" + ) + end + @component = Blink::Component["sleeper"] + } + + assert_nothing_raised() { + unless Blink::Objects::File.has_key?("../examples/root/etc/configfile") + Blink::Objects::File.new( + :path => "../examples/root/etc/configfile" + ) + end + @configfile = Blink::Objects::File["../examples/root/etc/configfile"] + } + assert_nothing_raised() { + unless Blink::Objects::Service.has_key?("sleeper") + Blink::Objects::Service.new( + :name => "sleeper", + :running => 1 + ) + Blink::Objects::Service.addpath( + File.expand_path("../examples/root/etc/init.d") + ) + end + @sleeper = Blink::Objects::Service["sleeper"] + } + assert_nothing_raised() { + @component.push( + @configfile, + @sleeper + ) + } + + #puts "Component is %s, id %s" % [@component, @component.object_id] + #puts "ConfigFile is %s, id %s" % [@configfile, @configfile.object_id] + end + + def test_name_calls + [@component,@sleeper,@configfile].each { |obj| + assert_nothing_raised(){ + obj.name + } + } + end + + def test_name_equality + #puts "Component is %s, id %s" % [@component, @component.object_id] + assert_equal( + "sleeper", + @component.name + ) + + assert_equal( + "../examples/root/etc/configfile", + @configfile.name + ) + + assert_equal( + "sleeper", + @sleeper.name + ) + end + + def test_object_retrieval + [@component,@sleeper,@configfile].each { |obj| + assert_equal( + obj.class[obj.name].object_id, + obj.object_id + ) + } + end +end |
