def test_bulk_build(self): ''' Test if it run bulk build on poudriere server. ''' ret = 'Could not find file /root/pkg_list on filesystem' mock = MagicMock(return_value='salt stack') with patch.dict(poudriere.__salt__, {'cmd.run': mock}), \ patch('salt.modules.poudriere._check_config_exists', MagicMock(return_value=True)): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), ret) with patch.object(os.path, 'isfile', MagicMock(return_value=True)): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), 'Could not find jail 90amd64') ret = ('There may have been an issue building ' 'packages dumping output: 90amd64 stack') with patch.object(os.path, 'isfile', MagicMock(return_value=True)), \ patch('salt.modules.poudriere._check_config_exists', MagicMock(return_value=True)): mock = MagicMock(return_value='90amd64 stack packages built') with patch.dict(poudriere.__salt__, {'cmd.run': mock}): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), '90amd64 stack packages built') mock = MagicMock(return_value='90amd64 stack') with patch.dict(poudriere.__salt__, {'cmd.run': mock}): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), ret)
def test_bulk_build(): """ Test if it run bulk build on poudriere server. """ ret = "Could not find file /root/pkg_list on filesystem" mock = MagicMock(return_value="salt stack") with patch.dict(poudriere.__salt__, {"cmd.run": mock}), patch( "salt.modules.poudriere._check_config_exists", MagicMock(return_value=True)): assert poudriere.bulk_build("90amd64", "/root/pkg_list") == ret with patch.object(os.path, "isfile", MagicMock(return_value=True)): assert (poudriere.bulk_build( "90amd64", "/root/pkg_list") == "Could not find jail 90amd64") ret = "There may have been an issue building packages dumping output: 90amd64 stack" with patch.object(os.path, "isfile", MagicMock(return_value=True)), patch( "salt.modules.poudriere._check_config_exists", MagicMock(return_value=True)): mock = MagicMock(return_value="90amd64 stack packages built") with patch.dict(poudriere.__salt__, {"cmd.run": mock}): assert (poudriere.bulk_build( "90amd64", "/root/pkg_list") == "90amd64 stack packages built") mock = MagicMock(return_value="90amd64 stack") with patch.dict(poudriere.__salt__, {"cmd.run": mock}): assert poudriere.bulk_build("90amd64", "/root/pkg_list") == ret
def test_bulk_build(self): ''' Test if it run bulk build on poudriere server. ''' ret = 'Could not find file /root/pkg_list on filesystem' mock = MagicMock(return_value='salt stack') with patch.dict(poudriere.__salt__, {'cmd.run': mock}): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), ret) with patch.object(os.path, 'isfile', MagicMock(return_value=True)): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), 'Could not find jail 90amd64') ret = ('There may have been an issue building ' 'packages dumping output: 90amd64 stack') with patch.object(os.path, 'isfile', MagicMock(return_value=True)): mock = MagicMock(return_value='90amd64 stack packages built') with patch.dict(poudriere.__salt__, {'cmd.run': mock}): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), '90amd64 stack packages built') mock = MagicMock(return_value='90amd64 stack') with patch.dict(poudriere.__salt__, {'cmd.run': mock}): self.assertEqual(poudriere.bulk_build('90amd64', '/root/pkg_list'), ret)