aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/config/tests/test_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/config/tests/test_config.py')
-rw-r--r--src/mailman_pgp/config/tests/test_config.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/mailman_pgp/config/tests/test_config.py b/src/mailman_pgp/config/tests/test_config.py
index 3ad4ca2..d3ef9ea 100644
--- a/src/mailman_pgp/config/tests/test_config.py
+++ b/src/mailman_pgp/config/tests/test_config.py
@@ -15,12 +15,15 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
+""""""
from unittest import TestCase
+from pkg_resources import resource_filename, resource_string
+
from mailman_pgp.config import config
-from mailman_pgp.database import Database
-from mailman_pgp.pgp import PGP
-from mailman_pgp.testing.layers import PGPConfigLayer
+from mailman_pgp.config.config import Config
+from mailman_pgp.config.validator import ConfigValidator
+from mailman_pgp.testing.layers import PGPConfigLayer, PGPLayer
class TestConfig(TestCase):
@@ -29,14 +32,21 @@ class TestConfig(TestCase):
def test_name(self):
self.assertEqual(config.name, 'pgp')
- def test_sections(self):
- sections = sorted(['db', 'keydirs', 'keypairs', 'queues', 'misc'])
- self.assertListEqual(sorted(config.sections()), sections)
- def test_db(self):
- self.assertTrue(hasattr(config, 'db'))
- self.assertIsInstance(config.db, Database)
+class TestConfigs(TestCase):
+ layer = PGPLayer
+
+ def setUp(self):
+ self.validator = ConfigValidator(
+ resource_string('mailman_pgp.config',
+ 'schema.cfg').decode('utf-8'))
+
+ def test_default_config(self):
+ cfg = Config()
+ cfg.read(resource_filename('mailman_pgp.config', 'mailman_pgp.cfg'))
+ self.validator.validate(cfg)
- def test_pgp(self):
- self.assertTrue(hasattr(config, 'pgp'))
- self.assertIsInstance(config.pgp, PGP)
+ def test_testing_config(self):
+ cfg = Config()
+ cfg.read(resource_filename('mailman_pgp.testing', 'mailman_pgp.cfg'))
+ self.validator.validate(cfg)