def test_dscl(): """ Tests the creation of a dscl node """ mac_mock = MagicMock(return_value={ "pid": 4948, "retcode": 0, "stderr": "", "stdout": "" }) with patch.dict(mac_user.__salt__, {"cmd.run_all": mac_mock}): with patch.dict( mac_user.__grains__, { "kernel": "Darwin", "osrelease": "10.9.1", "osrelease_info": (10, 9, 1) }, ): assert mac_user._dscl(["username", "UniqueID", 501]) == { "pid": 4948, "retcode": 0, "stderr": "", "stdout": "", }
def test_dscl(self): ''' Tests the creation of a dscl node ''' mac_mock = MagicMock(return_value={'pid': 4948, 'retcode': 0, 'stderr': '', 'stdout': ''}) with patch.dict(mac_user.__salt__, {'cmd.run_all': mac_mock}): with patch.dict(mac_user.__grains__, {'kernel': 'Darwin', 'osrelease': '10.9.1'}): self.assertEqual(mac_user._dscl('username'), {'pid': 4948, 'retcode': 0, 'stderr': '', 'stdout': ''})