예제 #1
0
 def test_build_bond_data(self):
     '''
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     '''
     mock = MagicMock(return_value=1)
     with patch.dict(debian_ip.__grains__, {'osrelease': mock}):
         self.assertTrue(debian_ip.build_bond('bond0', test='True'))
예제 #2
0
 def test_build_bond_data(self):
     '''
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     '''
     mock = MagicMock(return_value=1)
     with patch.dict(debian_ip.__grains__, {'osrelease': mock}):
         self.assertTrue(debian_ip.build_bond('bond0', test='True'))
예제 #3
0
 def test_build_bond_exception(self):
     '''
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     '''
     mock = MagicMock(return_value=1)
     with patch.dict(debian_ip.__grains__, {'osrelease': mock}):
         mock = MagicMock(
             side_effect=jinja2.exceptions.TemplateNotFound('error'))
         with patch.object(jinja2.Environment, 'get_template', mock):
             self.assertEqual(debian_ip.build_bond('bond0'), '')
예제 #4
0
 def test_build_bond_exception(self):
     '''
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     '''
     mock = MagicMock(return_value=1)
     with patch.dict(debian_ip.__grains__, {'osrelease': mock}):
         mock = MagicMock(side_effect=
                          jinja2.exceptions.TemplateNotFound('error'))
         with patch.object(jinja2.Environment, 'get_template', mock):
             self.assertEqual(debian_ip.build_bond('bond0'), '')
예제 #5
0
 def test_build_bond(self):
     '''
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     '''
     mock = MagicMock(return_value=1)
     with patch.dict(debian_ip.__grains__, {'osrelease': mock}):
         mock = MagicMock(return_value=True)
         with patch.dict(debian_ip.__salt__, {'kmod.load': mock,
                                              'pkg.install': mock}):
             self.assertEqual(debian_ip.build_bond('bond0'), '')
예제 #6
0
 def test_build_bond_data(self):
     """
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     """
     with patch("salt.modules.debian_ip._parse_settings_bond",
                MagicMock(return_value={})), patch(
                    "salt.modules.debian_ip._read_temp",
                    MagicMock(return_value=True)):
         mock = MagicMock(return_value=1)
         with patch.dict(debian_ip.__grains__, {"osrelease": mock}):
             self.assertTrue(debian_ip.build_bond("bond0", test="True"))
예제 #7
0
 def test_build_bond_exception(self):
     """
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     """
     with patch("salt.modules.debian_ip._parse_settings_bond",
                MagicMock(return_value={})):
         mock = MagicMock(return_value=1)
         with patch.dict(debian_ip.__grains__, {"osrelease": mock}):
             mock = MagicMock(
                 side_effect=jinja2.exceptions.TemplateNotFound("error"))
             with patch.object(jinja2.Environment, "get_template", mock):
                 self.assertEqual(debian_ip.build_bond("bond0"), "")
예제 #8
0
 def test_build_bond(self):
     """
     Test if it create a bond script in /etc/modprobe.d with the passed
     settings and load the bonding kernel module.
     """
     with patch("salt.modules.debian_ip._parse_settings_bond",
                MagicMock(return_value={})), patch(
                    "salt.modules.debian_ip._write_file",
                    MagicMock(return_value=True)):
         mock = MagicMock(return_value=1)
         with patch.dict(debian_ip.__grains__, {"osrelease": mock}):
             mock = MagicMock(return_value=True)
             with patch.dict(debian_ip.__salt__, {
                     "kmod.load": mock,
                     "pkg.install": mock
             }):
                 self.assertEqual(debian_ip.build_bond("bond0"), "")