예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    def generate_certificate(self) -> str:
        """
        Generate the certificates.

        Returns the pem certificate.
        """
        return DojotAPI.generate_certificate(self.jwt, self.csr["pem"])