From 209c0f35c4ac2b70dd00acfba940cc7a97bb9869 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 12 Jan 2015 00:38:55 +0000 Subject: [PATCH 1/3] Fix stripped kwarg from the merge forward --- salt/modules/brew.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/modules/brew.py b/salt/modules/brew.py index 48dab16d05..4234060259 100644 --- a/salt/modules/brew.py +++ b/salt/modules/brew.py @@ -36,7 +36,7 @@ def _list_taps(): return _call_brew(cmd)['stdout'].splitlines() -def _tap(tap): +def _tap(tap, runas=None): ''' Add unofficial Github repos to the list of formulas that brew tracks, updates, and installs from. From 9e121e33170a95b9a0af71a8f5da1ae376b86fe6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 12 Jan 2015 02:30:38 +0000 Subject: [PATCH 2/3] Fix brew unit tests --- tests/unit/modules/brew_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/modules/brew_test.py b/tests/unit/modules/brew_test.py index 79eb2478c2..bba101b207 100644 --- a/tests/unit/modules/brew_test.py +++ b/tests/unit/modules/brew_test.py @@ -61,7 +61,8 @@ class BrewTestCase(TestCase): mock_cmd = MagicMock(return_value='') with patch.dict(brew.__salt__, {'cmd.run_all': mock_failure, 'file.get_user': mock_user, - 'cmd.run': mock_cmd}): + 'cmd.run': mock_cmd, + 'cmd.retcode': mock_failure}): self.assertFalse(brew._tap('homebrew/test')) @patch('salt.modules.brew._list_taps', MagicMock(return_value=TAPS_LIST)) @@ -74,7 +75,8 @@ class BrewTestCase(TestCase): mock_cmd = MagicMock(return_value='') with patch.dict(brew.__salt__, {'cmd.run_all': mock_success, 'file.get_user': mock_user, - 'cmd.run': mock_cmd}): + 'cmd.run': mock_cmd, + 'cmd.retcode': mock_success}): self.assertTrue(brew._tap('homebrew/test')) # '_homebrew_bin' function tests: 1 From 0ceda58bd6d8866b88dc2d6f043debb2df4f1691 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 12 Jan 2015 16:51:02 +0000 Subject: [PATCH 3/3] Fix mock call. --- tests/unit/modules/brew_test.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/unit/modules/brew_test.py b/tests/unit/modules/brew_test.py index bba101b207..896630dfae 100644 --- a/tests/unit/modules/brew_test.py +++ b/tests/unit/modules/brew_test.py @@ -70,13 +70,7 @@ class BrewTestCase(TestCase): ''' Tests adding unofficial Github repos to the list of brew taps ''' - mock_success = MagicMock(return_value={'retcode': 0}) - mock_user = MagicMock(return_value='foo') - mock_cmd = MagicMock(return_value='') - with patch.dict(brew.__salt__, {'cmd.run_all': mock_success, - 'file.get_user': mock_user, - 'cmd.run': mock_cmd, - 'cmd.retcode': mock_success}): + with patch.dict(brew.__salt__, {'cmd.retcode': MagicMock(return_value=0)}): self.assertTrue(brew._tap('homebrew/test')) # '_homebrew_bin' function tests: 1