コード例 #1
0
ファイル: mac_keychain_test.py プロジェクト: lvg01/salt.old
 def test_install_cert(self):
     '''
         Test installing a certificate into the OSX keychain
     '''
     mock = MagicMock()
     with patch.dict(keychain.__salt__, {'cmd.run': mock}):
         keychain.install('/path/to/cert.p12', 'passw0rd')
         mock.assert_called_once_with('security import /path/to/cert.p12 -P passw0rd '
                                      '-k /Library/Keychains/System.keychain')
コード例 #2
0
 def test_install_cert(self):
     """
         Test installing a certificate into the macOS keychain
     """
     mock = MagicMock()
     with patch.dict(keychain.__salt__, {"cmd.run": mock}):
         keychain.install("/path/to/cert.p12", "passw0rd")
         mock.assert_called_once_with(
             "security import /path/to/cert.p12 -P passw0rd "
             "-k /Library/Keychains/System.keychain")
コード例 #3
0
ファイル: mac_keychain_test.py プロジェクト: lvg01/salt.old
 def test_install_cert_extras(self, unlock_mock):
     '''
         Test installing a certificate into the OSX keychain with extras
     '''
     mock = MagicMock()
     with patch.dict(keychain.__salt__, {'cmd.run': mock}):
         keychain.install('/path/to/cert.p12', 'passw0rd', '/path/to/chain', allow_any=True,
                          keychain_password='******')
         unlock_mock.assert_called_once_with('/path/to/chain', 'passw0rd1')
         mock.assert_called_once_with('security import /path/to/cert.p12 -P passw0rd -k /path/to/chain -A')
コード例 #4
0
 def test_install_cert_extras(self):
     """
         Test installing a certificate into the macOS keychain with extras
     """
     mock = MagicMock()
     with patch.dict(keychain.__salt__, {
             "cmd.run": mock
     }), patch("salt.modules.mac_keychain.unlock_keychain") as unlock_mock:
         keychain.install(
             "/path/to/cert.p12",
             "passw0rd",
             "/path/to/chain",
             allow_any=True,
             keychain_password="******",
         )
         unlock_mock.assert_called_once_with("/path/to/chain", "passw0rd1")
         mock.assert_called_once_with(
             "security import /path/to/cert.p12 -P passw0rd -k /path/to/chain -A"
         )