def test_build_routes_exception(self): ''' Test if it add route scripts for a network interface using up commands. ''' self.assertTrue(debian_ip.build_routes('eth0', test='True')) mock = MagicMock(side_effect=jinja2.exceptions.TemplateNotFound('err')) with patch.object(jinja2.Environment, 'get_template', mock): self.assertEqual(debian_ip.build_routes('eth0'), '')
def test_build_routes_exception(self): """ Test if it add route scripts for a network interface using up commands. """ with patch( "salt.modules.debian_ip._parse_routes", MagicMock(return_value={"routes": []}), ): self.assertTrue(debian_ip.build_routes("eth0", test="True")) mock = MagicMock( side_effect=jinja2.exceptions.TemplateNotFound("err")) with patch.object(jinja2.Environment, "get_template", mock): self.assertEqual(debian_ip.build_routes("eth0"), "")
def test_build_routes(self): ''' Test if it add route scripts for a network interface using up commands. ''' with patch('salt.modules.debian_ip._parse_routes', MagicMock(return_value={'routes': []})), \ patch('salt.modules.debian_ip._write_file_routes', MagicMock(return_value=True)), \ patch('salt.modules.debian_ip._read_file', MagicMock(return_value='salt')): self.assertEqual(debian_ip.build_routes('eth0'), 'saltsalt')
def test_build_routes(self): """ Test if it add route scripts for a network interface using up commands. """ with patch( "salt.modules.debian_ip._parse_routes", MagicMock(return_value={"routes": []}), ), patch("salt.modules.debian_ip._write_file_routes", MagicMock(return_value=True)), patch( "salt.modules.debian_ip._read_file", MagicMock(return_value="salt")): self.assertEqual(debian_ip.build_routes("eth0"), "saltsalt")
def test_build_routes(self): ''' Test if it add route scripts for a network interface using up commands. ''' self.assertEqual(debian_ip.build_routes('eth0'), 'saltsalt')