Update Configuration test

This commit is contained in:
Jakub Warmuz 2015-05-01 10:19:48 +00:00
parent 8c43404015
commit 0845d82f65
No known key found for this signature in database
GPG key ID: 2A7BAD3A489B52EA

View file

@ -1,4 +1,5 @@
"""Tests for letsencrypt.client.configuration."""
import os
import unittest
import mock
@ -18,6 +19,14 @@ class NamespaceConfigTest(unittest.TestCase):
self.assertEqual(self.config.foo, 'bar')
self.assertEqual(self.config.work_dir, '/tmp/foo')
def test_server_path(self):
self.assertEqual(['acme-server.org:443', 'new'],
self.config.server_path.split(os.path.sep))
def test_server_url(self):
self.assertEqual(
self.config.server_url, 'https://acme-server.org:443/new')
@mock.patch('letsencrypt.client.configuration.constants')
def test_dynamic_dirs(self, constants):
constants.TEMP_CHECKPOINT_DIR = 't'
@ -30,13 +39,13 @@ class NamespaceConfigTest(unittest.TestCase):
self.assertEqual(self.config.temp_checkpoint_dir, '/tmp/foo/t')
self.assertEqual(self.config.in_progress_dir, '/tmp/foo/../p')
self.assertEqual(
self.config.cert_key_backup, '/tmp/foo/c/acme-server.org')
self.config.cert_key_backup, '/tmp/foo/c/acme-server.org:443/new')
self.assertEqual(self.config.rec_token_dir, '/r')
self.assertEqual(
self.config.accounts_dir, '/tmp/config/acc/acme-server.org-443-new')
self.config.accounts_dir, '/tmp/config/acc/acme-server.org:443/new')
self.assertEqual(
self.config.account_keys_dir,
'/tmp/config/acc/acme-server.org-443-new/keys')
'/tmp/config/acc/acme-server.org:443/new/keys')
if __name__ == '__main__':