diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-04 02:21:04 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-06-04 02:21:04 +0000 |
| commit | a7b057de317ffc60e50405ea1ebb109ba4003b4f (patch) | |
| tree | 5496c4729876e4afee002574fa4c5e326df63c82 /test | |
| parent | 0cfd28ecae07178884c7de6252db36a91ecc9062 (diff) | |
| download | puppet-a7b057de317ffc60e50405ea1ebb109ba4003b4f.tar.gz puppet-a7b057de317ffc60e50405ea1ebb109ba4003b4f.tar.xz puppet-a7b057de317ffc60e50405ea1ebb109ba4003b4f.zip | |
Adding a "source" attribute to providers, so eventually types will be able to avoid duplication during listing by only listing one provider for each source (e.g., dpkg and aptitude should not both be listed).
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2550 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rwxr-xr-x | test/ral/providers/provider.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb index fcc6aaa09..9e59f2008 100755 --- a/test/ral/providers/provider.rb +++ b/test/ral/providers/provider.rb @@ -28,6 +28,15 @@ class TestProvider < Test::Unit::TestCase return provider end + def setup + super + @type = Puppet::Type.newtype(:provider_test) do + newparam(:name) {} + ensurable + end + cleanup { Puppet::Type.rmtype(:provider_test) } + end + def test_confine provider = newprovider @@ -243,6 +252,47 @@ class TestProvider < Test::Unit::TestCase optional.missing end end + + # Disabling, since I might not keep this interface + def disabled_test_read_and_each + # Create a new provider + provider = @type.provide(:testing) + + assert_raise(Puppet::DevError, "Did not fail when :read was not overridden") do + provider.read + end + + children = [:one, :two] + provider.meta_def(:read) do + children + end + + result = [] + assert_nothing_raised("could not call 'each' on provider class") do + provider.each { |i| result << i } + end + + assert_equal(children, result, "did not get correct list from each") + + assert_equal(children, provider.collect { |i| i }, "provider does not include enumerable") + end + + def test_source + base = @type.provide(:base) + + assert_equal(:base, base.source, "source did not default correctly") + assert_equal(:base, base.source, "source did not default correctly") + + sub = @type.provide(:sub, :parent => :base) + + assert_equal(:sub, sub.source, "source did not default correctly for sub class") + assert_equal(:sub, sub.source, "source did not default correctly for sub class") + + other = @type.provide(:other, :parent => :base, :source => :base) + + assert_equal(:base, other.source, "source did not override") + assert_equal(:base, other.source, "source did not override") + end end class TestProviderFeatures < Test::Unit::TestCase |
