Coverage for frappe_manager / ssl_manager / no_op_certificate_service.py: 61%

18 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-07-02 18:35 +0530

1from pathlib import Path 

2 

3from frappe_manager.logger.contextual import ContextualLogger 

4from frappe_manager.output_manager import OutputHandler 

5from frappe_manager.output_manager.rich_output import RichOutputHandler 

6from frappe_manager.ssl_manager.certificate import SSLCertificate 

7from frappe_manager.ssl_manager.ssl_certificate_service import SSLCertificateService 

8 

9 

10class NoOpCertificateService(SSLCertificateService): 

11 def __init__( 

12 self, 

13 logger: ContextualLogger, 

14 root_dir: Path = Path("/dev/null"), 

15 output_handler: OutputHandler | None = None, 

16 ): 

17 self.logger = logger.child(component="noop_ssl") 

18 self.root_dir = root_dir 

19 self.output = output_handler or RichOutputHandler() 

20 

21 def renew_certificate(self, certificate: "SSLCertificate", dry_run: bool = False) -> bool: 

22 return True 

23 

24 def remove_certificate(self, certificate: "SSLCertificate") -> bool: 

25 self.output.warning(f"{certificate.domain} doesn't have certificate issued") 

26 return False 

27 

28 def generate_certificate(self, certificate: "SSLCertificate", dry_run: bool = False) -> tuple[Path, Path]: 

29 return Path("/dev/null"), Path("/dev/null")