Revize 2a90f4fd
Přidáno uživatelem Stanislav Král před asi 4 roky(ů)
src/services/certificate_service.py | ||
---|---|---|
52 | 52 |
certificate = Certificate(-1, common_name, not_before_formatted, not_after_formatted, cert_pem, |
53 | 53 |
private_key_id, cert_type, parent_id, usages) |
54 | 54 |
|
55 |
print(f"CW: {parent_id} {certificate.parent_id}") |
|
56 | 55 |
return certificate |
57 | 56 |
|
58 | 57 |
# TODO config parameter present in class diagram but not here (unused) |
... | ... | |
111 | 110 |
issuer_key_pass=issuer_key.password, extensions=extensions, |
112 | 111 |
days=days) |
113 | 112 |
|
114 |
print(f"test cert {issuer_cert.certificate_id}") |
|
115 | 113 |
# wrap the generated certificate using Certificate class |
116 | 114 |
certificate = self.__create_wrapper(cert_pem, subject_key.private_key_id, subject.common_name, usages, |
117 | 115 |
issuer_cert.certificate_id, CERTIFICATE_ID) |
118 | 116 |
|
119 |
print(f"parent cert {certificate.parent_id}") |
|
120 |
|
|
121 | 117 |
created_id = self.certificate_repository.create(certificate) |
122 | 118 |
|
123 | 119 |
certificate.certificate_id = created_id |
124 | 120 |
|
125 |
print(f"parent cert {certificate.parent_id}") |
|
126 |
|
|
127 | 121 |
return certificate |
128 | 122 |
|
129 | 123 |
def get_certificate(self, unique_id: int) -> Certificate: |
130 | 124 |
return self.certificate_repository.read(unique_id) |
125 |
|
|
126 |
def get_certificates(self, cert_type=None) -> Certificate: |
|
127 |
return self.certificate_repository.read_all(cert_type) |
Také k dispozici: Unified diff
Re #8472 - Implemented get_certificates method and added an integration test validating it
Added fixtures providing a unique DB connection for each test