mirror of
https://github.com/certbot/certbot.git
synced 2026-04-15 22:20:28 -04:00
Implement basic get_all_certs_keys, tests pass.
This commit is contained in:
parent
e75bafa439
commit
c6baa82ee4
2 changed files with 17 additions and 7 deletions
|
|
@ -296,6 +296,17 @@ class PostfixConfigGenerator:
|
|||
- `path` - file path to configuration file
|
||||
:rtype: list
|
||||
"""
|
||||
cert_materials = {'smtpd_tls_key_file': None,
|
||||
'smtpd_tls_cert_file': None,
|
||||
}
|
||||
for num, line in enumerate(self.cf):
|
||||
print 'Line is: %s' % line
|
||||
num, found_var, found_value = parse_line((num, line))
|
||||
if found_var in cert_materials.keys():
|
||||
cert_materials[found_var] = found_value
|
||||
return [(cert_materials['smtpd_tls_cert_file'],
|
||||
cert_materials['smtpd_tls_key_file'],
|
||||
self.fn),]
|
||||
|
||||
def save(self, title=None, temporary=False):
|
||||
"""Saves all changes to the configuration files.
|
||||
|
|
|
|||
|
|
@ -24,10 +24,9 @@ mydomain = fubard.org
|
|||
myorigin = fubard.org"""
|
||||
|
||||
|
||||
certs_only_config = """
|
||||
smtpd_tls_cert_file = /etc/letsencrypt/live/www.fubard.org/fullchain.pem
|
||||
smtpd_tls_key_file = /etc/letsencrypt/live/www.fubard.org/privkey.pem
|
||||
"""
|
||||
certs_only_config = (
|
||||
"""smtpd_tls_cert_file = /etc/letsencrypt/live/www.fubard.org/fullchain.pem
|
||||
smtpd_tls_key_file = /etc/letsencrypt/live/www.fubard.org/privkey.pem""")
|
||||
|
||||
|
||||
def GetFakeOpen(fake_file_contents):
|
||||
|
|
@ -65,9 +64,9 @@ class TestPostfixConfigGenerator(unittest.TestCase):
|
|||
self.assertEqual(sorted_names, postfix_config_gen.get_all_names())
|
||||
|
||||
def testGetAllCertAndKeys(self):
|
||||
return_vals = ('/etc/letsencrypt/live/www.fubard.org/fullchain.pem',
|
||||
'/etc/letsencrypt/live/www.fubard.org/privkey.pem',
|
||||
None)
|
||||
return_vals = [('/etc/letsencrypt/live/www.fubard.org/fullchain.pem',
|
||||
'/etc/letsencrypt/live/www.fubard.org/privkey.pem',
|
||||
'tests/main.cf'),]
|
||||
postfix_config_gen = pcg.PostfixConfigGenerator(
|
||||
self.config,
|
||||
self.postfix_dir,
|
||||
|
|
|
|||
Loading…
Reference in a new issue