def test_generate_certificate(self, mock_requests): """ Test generate certificate """ DojotAPI.generate_certificate(self.jwt, self.csr) DojotAPI.call_api.assert_called_once_with(mock_requests.post, self.args)
def test_generate_certificate_exception(self, mock_requests): """ Should not generate the cert, because rose an exception. """ DojotAPI.call_api.side_effect = APICallError() with self.assertRaises(Exception) as context: DojotAPI.generate_certificate(self.jwt, self.csr) self.assertIsNotNone(context.exception) self.assertIsInstance(context.exception, APICallError) DojotAPI.call_api.assert_called_once_with(mock_requests.post, self.args)
def generate_certificate(self) -> str: """ Generate the certificates. Returns the pem certificate. """ return DojotAPI.generate_certificate(self.jwt, self.csr["pem"])