示例#1
0
 def test_add_store(self):
     '''
         Test adding a certificate to a specific store
     '''
     cmd_mock = MagicMock(return_value='CertInfo\r\nSerial: XYZABC\r\nOtherStuff')
     cache_mock = MagicMock(return_value='/tmp/cert.cer')
     with patch.dict(certutil.__salt__, {'cmd.run': cmd_mock,
                                         'cp.cache_file': cache_mock}):
         certutil.add_store('salt://path/to/file', 'TrustedPublisher')
         cmd_mock.assert_called_once_with('certutil.exe -addstore TrustedPublisher /tmp/cert.cer')
         cache_mock.assert_called_once_with('salt://path/to/file', 'base')
示例#2
0
 def test_add_store(self):
     '''
         Test adding a certificate to a specific store
     '''
     cmd_mock = MagicMock(return_value=(
         'CertInfo\r\n'
         '================ Certificate 0 ================\r\n'
         'Serial Number: 180720d39cd2db3244ba037417241e90\r\n'
         'OtherStuff'))
     cache_mock = MagicMock(return_value='/tmp/cert.cer')
     with patch.dict(certutil.__salt__, {'cmd.run': cmd_mock,
                                         'cp.cache_file': cache_mock}):
         certutil.add_store('salt://path/to/file', 'TrustedPublisher')
         cmd_mock.assert_called_once_with(
             'certutil.exe -addstore TrustedPublisher /tmp/cert.cer')
         cache_mock.assert_called_once_with('salt://path/to/file', 'base')
示例#3
0
 def test_add_store(self):
     """
     Test adding a certificate to a specific store
     """
     cmd_mock = MagicMock(
         return_value=("CertInfo\r\n"
                       "================ Certificate 0 ================\r\n"
                       "Serial Number: 180720d39cd2db3244ba037417241e90\r\n"
                       "OtherStuff"))
     cache_mock = MagicMock(return_value="/tmp/cert.cer")
     with patch.dict(certutil.__salt__, {
             "cmd.run": cmd_mock,
             "cp.cache_file": cache_mock
     }):
         certutil.add_store("salt://path/to/file", "TrustedPublisher")
         cmd_mock.assert_called_once_with(
             "certutil.exe -addstore TrustedPublisher /tmp/cert.cer")
         cache_mock.assert_called_once_with("salt://path/to/file", "base")