Coverage for src/ansible_sign/signing/base.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-03-29 20:49 +0000

1class SignatureVerificationResult: 

2 """Represents the result after performing signature verification.""" 

3 

4 def __init__(self, success, summary, extra_information={}): 

5 self.success = success 

6 self.summary = summary 

7 self.extra_information = extra_information 

8 

9 def __bool__(self): 

10 return self.success 

11 

12 

13class SignatureVerifier: 

14 """ 

15 Represents a way of performing content verification. It doesn't make any 

16 assumptions about the kind of verification being done. 

17 """ 

18 

19 def verify(self) -> SignatureVerificationResult: 

20 """ 

21 Does the actual verification. 

22 

23 Returns an instance of SignatureVerificationResult. 

24 """ 

25 raise NotImplementedError("verify") 

26 

27 

28class SignatureSigningResult: 

29 """Represents the result after performing signing.""" 

30 

31 def __init__(self, success, summary, extra_information={}): 

32 self.success = success 

33 self.summary = summary 

34 self.extra_information = extra_information 

35 

36 def __bool__(self): 

37 return self.success 

38 

39 

40class SignatureSigner: 

41 """ 

42 Represents a way of signing content for later verification. This interface 

43 makes no assumptions about the kind of verification being done. 

44 """ 

45 

46 def sign(self): 

47 """ 

48 Signs a file. 

49 """ 

50 raise NotImplementedError("sign")