Merge pull request #24313 from nicholascapo/fix-22991-npm.installed-test-true

Fix #22991 Correctly set result when test=True
This commit is contained in:
Thomas S Hatch 2015-06-03 08:49:18 -06:00
commit ae681a4db1
2 changed files with 3 additions and 1 deletions

View file

@ -169,6 +169,7 @@ def installed(name,
if pkgs_satisfied:
comment_msg.append('Package(s) {0!r} satisfied by {1}'
.format(', '.join(pkg_list), ', '.join(pkgs_satisfied)))
ret['result'] = True
ret['comment'] = '. '.join(comment_msg)
return ret

View file

@ -27,6 +27,7 @@ npm.__opts__ = {}
@skipIf(NO_MOCK, NO_MOCK_REASON)
class NpmTestCase(TestCase):
'''
Test cases for salt.states.npm
'''
@ -56,7 +57,7 @@ class NpmTestCase(TestCase):
with patch.dict(npm.__opts__, {'test': True}):
comt = ("Package(s) 'coffee-script' "
"satisfied by coffee-script@1.2")
ret.update({'comment': comt, 'result': None})
ret.update({'comment': comt, 'result': True})
self.assertDictEqual(npm.installed(name), ret)
with patch.dict(npm.__opts__, {'test': False}):