mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Write an integration test demonstrating the issue
This commit is contained in:
parent
6942d5d95b
commit
f2c045520d
@ -1233,6 +1233,11 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
# write a line to file
|
||||
with salt.utils.fopen(name, 'w+') as fp_:
|
||||
fp_.write('comment_me')
|
||||
|
||||
# Look for changes with test=True: return should be "None" at the first run
|
||||
ret = self.run_state('file.comment', test=True, name=name, regex='^comment')
|
||||
self.assertSaltNoneReturn(ret)
|
||||
|
||||
# comment once
|
||||
ret = self.run_state('file.comment', name=name, regex='^comment')
|
||||
# result is positive
|
||||
@ -1248,6 +1253,11 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
# line is still commented
|
||||
with salt.utils.fopen(name, 'r') as fp_:
|
||||
self.assertTrue(fp_.read().startswith('#comment'))
|
||||
|
||||
# Test previously commented file returns "True" now and not "None" with test=True
|
||||
ret = self.run_state('file.comment', test=True, name=name, regex='^comment')
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
finally:
|
||||
os.remove(name)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user