def test_assign(self): ''' Tests the return of successful assign function ''' cmd = {'pid': 3548, 'retcode': 0, 'stderr': '', 'stdout': 'net.inet.icmp.icmplim: 250 -> 50'} ret = {'net.inet.icmp.icmplim': '50'} mock_cmd = MagicMock(return_value=cmd) with patch.dict(mac_sysctl.__salt__, {'cmd.run_all': mock_cmd}): self.assertEqual(mac_sysctl.assign( 'net.inet.icmp.icmplim', 50), ret)
def test_assign(): """ Tests the return of successful assign function """ cmd = { "pid": 3548, "retcode": 0, "stderr": "", "stdout": "net.inet.icmp.icmplim: 250 -> 50", } ret = {"net.inet.icmp.icmplim": "50"} mock_cmd = MagicMock(return_value=cmd) with patch.dict(mac_sysctl.__salt__, {"cmd.run_all": mock_cmd}): assert mac_sysctl.assign("net.inet.icmp.icmplim", 50) == ret