def test_checkout(self, ls, os, check_call, check_output): mock_args = MagicMock(name='Mock Args') ls.return_value = ['opal', 'someotherpackage'] with patch.object(commandline, 'get_requirements') as reqs: with patch.object(commandline, 'write') as writer: reqs.return_value = {'opal': 'v10.8.0'} commandline.checkout(mock_args) os.assert_any_call('git checkout v10.8.0') os.assert_any_call('python setup.py develop') writer.assert_any_call('checking out opal to v10.8.0')
def test_checkout_clones_package(self, ls, os, check_call, check_output): mock_args = MagicMock(name='Mock Args') ls.return_value = ['opal', 'someotherpackage'] with patch.object(commandline, 'get_requirements') as reqs: with patch.object(commandline, 'write') as writer: reqs.return_value = { 'opal': 'v10.8.0', 'missingpackage': '1.0' } commandline.checkout(mock_args) writer.assert_any_call('missingpackage is missing')
def test_checkout_clones_package(self, ls, os, check_call, check_output): mock_args = MagicMock(name='Mock Args') ls.return_value = ['opal', 'someotherpackage'] with patch.object(commandline, 'get_requirements') as reqs: with patch.object(commandline, 'write') as writer: reqs.return_value = { 'opal' : 'v10.8.0', 'missingpackage': '1.0' } commandline.checkout(mock_args) writer.assert_any_call('missingpackage is missing')
def test_checkout(self, ls, os, check_call, check_output): mock_args = MagicMock(name='Mock Args') ls.return_value = ['opal', 'someotherpackage'] with patch.object(commandline, 'get_requirements') as reqs: with patch.object(commandline, 'write') as writer: reqs.return_value = { 'opal': 'v10.8.0' } commandline.checkout(mock_args) os.assert_any_call('git checkout v10.8.0') os.assert_any_call('python setup.py develop') writer.assert_any_call('checking out opal to v10.8.0')
def test_checkout_with_uncommitted(self, ls, os, check_call, check_output): mock_args = MagicMock(name='Mock Args') ls.return_value = ['opal'] with patch.object(commandline, 'get_requirements') as reqs: with patch.object(commandline, 'write') as writer: with patch.object(commandline, 'check_for_uncommitted') as checker: reqs.return_value = { 'opal' : 'v10.8.0', } checker.return_value = 41 commandline.checkout(mock_args) writer.assert_any_call('We have uncommitted changes in opal') writer.assert_any_call('Abandonning attempt to check out to requirements.txt')
def test_checkout_with_uncommitted(self, ls, os, check_call, check_output): mock_args = MagicMock(name='Mock Args') ls.return_value = ['opal'] with patch.object(commandline, 'get_requirements') as reqs: with patch.object(commandline, 'write') as writer: with patch.object(commandline, 'check_for_uncommitted') as checker: reqs.return_value = { 'opal': 'v10.8.0', } checker.return_value = 41 commandline.checkout(mock_args) writer.assert_any_call( 'We have uncommitted changes in opal') writer.assert_any_call( 'Abandonning attempt to check out to requirements.txt')