Projekt

Obecné

Profil

« Předchozí | Další » 

Revize fb987403

Přidáno uživatelem Michal Seják před asi 4 roky(ů)

Re #8476 - Added and tested `get_certificate(id)`.

Zobrazit rozdíly:

src/controllers/certificates_controller.py
156 156
        """
157 157
        CertController.setup()  # TODO remove after issue fixed
158 158

  
159
        if connexion.request.is_json:
160
            id = IdParameter.from_dict(connexion.request.get_json())  # noqa: E501
161
        return 'do some magic!'
159
        try:
160
            v = int(id)
161
        except ValueError:
162
            return E_WRONG_PARAMETERS, 400
163

  
164
        cert = CERTIFICATE_SERVICE.get_certificate(v)
165

  
166
        if cert is None:
167
            return E_NO_CERTIFICATES_FOUND, 205                 # TODO related to 204 issue
168
        else:
169
            return {"success": True, "data": cert.pem_data}
162 170

  
163 171
    @staticmethod
164 172
    def get_certificate_details_by_id(id):  # noqa: E501
......
217 225
        if certs is None:
218 226
            return E_GENERAL_ERROR, 500
219 227
        elif len(certs) == 0:
220
            return E_NO_CERTIFICATES_FOUND, 204
228
            return E_NO_CERTIFICATES_FOUND, 205         # TODO related to 204 issue
221 229
        else:
222 230
            ret = []
223 231
            for c in certs:

Také k dispozici: Unified diff