summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-05 22:35:53 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-05 22:35:53 +0000
commitfa16a92ff96d37d6b0d443536218d9d46d56eadd (patch)
treed40ecfa1e23c9a258e837a628f0d542c4637af86 /test
parente28250dc1d30cf9e9c13e157143e140b402c967e (diff)
downloadpuppet-fa16a92ff96d37d6b0d443536218d9d46d56eadd.tar.gz
puppet-fa16a92ff96d37d6b0d443536218d9d46d56eadd.tar.xz
puppet-fa16a92ff96d37d6b0d443536218d9d46d56eadd.zip
Fixing small bug in cron where removed fields are not deleted from the file
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1565 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rwxr-xr-xtest/types/cron.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/types/cron.rb b/test/types/cron.rb
index caada9f91..ed822ab4b 100755
--- a/test/types/cron.rb
+++ b/test/types/cron.rb
@@ -57,18 +57,25 @@ class TestCron < Test::Unit::TestCase
end
# Create a cron job with all fields filled in.
- def mkcron(name)
+ def mkcron(name, addargs = true)
cron = nil
- assert_nothing_raised {
- cron = @crontype.create(
- :command => "date > %s/crontest%s" % [tmpdir(), name],
+ command = "date > %s/crontest%s" % [tmpdir(), name]
+ args = nil
+ if addargs
+ args = {
+ :command => command,
:name => name,
:user => @me,
:minute => rand(59),
:month => "1",
:monthday => "1",
:hour => "1"
- )
+ }
+ else
+ args = {:command => command, :name => name}
+ end
+ assert_nothing_raised {
+ cron = @crontype.create(args)
}
return cron
@@ -554,16 +561,16 @@ class TestCron < Test::Unit::TestCase
end
def test_value
- cron = mkcron("valuetesting")
+ cron = mkcron("valuetesting", false)
# First, test the normal states
[:minute, :hour, :month].each do |param|
+ cron.newstate(param)
state = cron.state(param)
assert(state, "Did not get %s state" % param)
assert_nothing_raised {
- state.should = :absent
state.is = :absent
}
@@ -602,10 +609,11 @@ class TestCron < Test::Unit::TestCase
end
# Now make sure that :command works correctly
+ cron.delete(:command)
+ cron.newstate(:command)
state = cron.state(:command)
assert_nothing_raised {
- state.should = :absent
state.is = :absent
}