Ejemplo n.º 1
0
 def test_delete_with_string(self):
     netmri = InfobloxNetMRI(**self.opts)
     with patch.object(netmri, 'session') as mock_request:
         netmri.delete('job', '321')
         mock_request.request.assert_called_with("delete",
                                                 'https://localhost/api/3/jobs/321',
                                                 headers={'Content-type': 'application/json'},
                                                 data=None)
Ejemplo n.º 2
0
 def test_show(self):
     netmri = InfobloxNetMRI(**self.opts)
     with patch.object(netmri, 'session') as mock_request:
         netmri.show('job', 123)
         mock_request.request.assert_called_with("get",
                                                 'https://localhost/api/3/jobs/123',
                                                 headers={'Content-type': 'application/json'},
                                                 data=None)
 def test_delete_with_string(self):
     netmri = InfobloxNetMRI(**self.opts)
     with patch.object(netmri, 'session') as mock_request:
         netmri.delete('job', '321')
         mock_request.request.assert_called_with(
             "delete",
             'https://localhost/api/3.1/jobs/321',
             headers={'Content-type': 'application/json'},
             data=None)
 def test_show(self):
     netmri = InfobloxNetMRI(**self.opts)
     with patch.object(netmri, 'session') as mock_request:
         netmri.show('job', 123)
         mock_request.request.assert_called_with(
             "get",
             'https://localhost/api/3.1/jobs/123',
             headers={'Content-type': 'application/json'},
             data=None)
    def test_init_ssl_verify_bool(self):
        netmri = InfobloxNetMRI(**self.opts)
        self.assertEqual(False, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify="no", **self.opts)
        self.assertEqual(False, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify="off", **self.opts)
        self.assertEqual(False, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify=False, **self.opts)
        self.assertEqual(False, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify="false", **self.opts)
        self.assertEqual(False, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify="true", **self.opts)
        self.assertEqual(True, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify='yes', **self.opts)
        self.assertEqual(True, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify='on', **self.opts)
        self.assertEqual(True, netmri.ssl_verify)

        netmri = InfobloxNetMRI(ssl_verify=True, **self.opts)
        self.assertEqual(True, netmri.ssl_verify)
    def test_init_ssl_verify_file(self, mock_isfile):
        mock_isfile.return_value = True
        netmri = InfobloxNetMRI(ssl_verify='/some/path.crt', **self.opts)
        self.assertEqual('/some/path.crt', netmri.ssl_verify)

        mock_isfile.return_value = False
        self.assertRaises(ValueError,
                          InfobloxNetMRI,
                          ssl_verify='/some/path.crt',
                          **self.opts)
 def test_init_valid(self):
     netmri = InfobloxNetMRI(**self.opts)
     self.assertEqual(type(netmri), InfobloxNetMRI)