示例#1
0
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": "",
            }
示例#2
0
 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': ''})
示例#3
0
 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': ''})