Exemple #1
0
 def test_create_cert_binding(self):
     '''
     Test - Assign a certificate to an IIS binding.
     '''
     kwargs = {'name': '9988776655443322111000AAABBBCCCDDDEEEFFF',
               'site': 'MyTestSite', 'hostheader': 'mytestsite.local',
               'ipaddress': '*', 'port': 443}
     with patch.dict(win_iis.__salt__):
         self.assertTrue(win_iis.create_cert_binding(**kwargs))
Exemple #2
0
 def test_create_cert_binding(self):
     '''
     Test - Assign a certificate to an IIS binding.
     '''
     kwargs = {'name': '9988776655443322111000AAABBBCCCDDDEEEFFF',
               'site': 'MyTestSite', 'hostheader': 'mytestsite.local',
               'ipaddress': '*', 'port': 443}
     with patch.dict(win_iis.__salt__), \
             patch('salt.modules.win_iis._list_certs',
                   MagicMock(return_value={'9988776655443322111000AAABBBCCCDDDEEEFFF': None})), \
             patch('salt.modules.win_iis._srvmgr',
                   MagicMock(return_value={'retcode': 0, 'stdout': 10})), \
             patch('salt.utils.json.loads', MagicMock(return_value=[{'MajorVersion': 10, 'MinorVersion': 0}])), \
             patch('salt.modules.win_iis.list_bindings',
                   MagicMock(return_value=BINDING_LIST)), \
            patch('salt.modules.win_iis.list_cert_bindings',
                   MagicMock(return_value={CERT_BINDING_INFO: BINDING_LIST[CERT_BINDING_INFO]})):
         self.assertTrue(win_iis.create_cert_binding(**kwargs))
 def test_create_cert_binding(self):
     """
     Test - Assign a certificate to an IIS binding.
     """
     kwargs = {
         "name": "9988776655443322111000AAABBBCCCDDDEEEFFF",
         "site": "MyTestSite",
         "hostheader": "mytestsite.local",
         "ipaddress": "*",
         "port": 443,
     }
     with patch.dict(win_iis.__salt__), patch(
             "salt.modules.win_iis._list_certs",
             MagicMock(return_value={
                 "9988776655443322111000AAABBBCCCDDDEEEFFF": None
             }),
     ), patch(
             "salt.modules.win_iis._srvmgr",
             MagicMock(return_value={
                 "retcode": 0,
                 "stdout": 10
             }),
     ), patch(
             "salt.utils.json.loads",
             MagicMock(return_value=[{
                 "MajorVersion": 10,
                 "MinorVersion": 0
             }]),
     ), patch("salt.modules.win_iis.list_bindings",
              MagicMock(return_value=BINDING_LIST)), patch(
                  "salt.modules.win_iis.list_cert_bindings",
                  MagicMock(
                      return_value={
                          CERT_BINDING_INFO: BINDING_LIST[CERT_BINDING_INFO]
                      }),
              ):
         self.assertTrue(win_iis.create_cert_binding(**kwargs))