From bd625ca985bbfa472f84b1c3e03b358aa80567ae Mon Sep 17 00:00:00 2001 From: ulif <uli@gnufix.de> Date: Thu, 5 Nov 2015 13:49:45 +0100 Subject: [PATCH] Start support for config files. --- diceware/config.py | 36 ++++++++++++++++++++++++++++++++++++ tests/test_config.py | 9 +++++++++ 2 files changed, 45 insertions(+) create mode 100644 diceware/config.py create mode 100644 tests/test_config.py diff --git a/diceware/config.py b/diceware/config.py new file mode 100644 index 0000000..ccf8a66 --- /dev/null +++ b/diceware/config.py @@ -0,0 +1,36 @@ +# diceware -- passphrases to remember +# Copyright (C) 2015 Uli Fouquet +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +"""config -- diceware configuration + +`diceware` is configurable via commandline, configuration files and +direct API calls. + +""" +import argparse +try: + import configparser # Python 3.x +except ImportError: # pragma: no cover + import ConfigParser as configparser # Python 2.x + + +OPTIONS_DEFAULTS = dict( + num=6, + caps=True, + specials=0, + delimiter="", + randomsource="system", + wordlist="en_8k", + ) diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..9b29cfa --- /dev/null +++ b/tests/test_config.py @@ -0,0 +1,9 @@ +from diceware.config import OPTIONS_DEFAULTS + + +class TestConfigModule(object): + # tests for diceware.config + + def test_defaults(self): + # there is a set of defaults for options available + assert OPTIONS_DEFAULTS is not None -- GitLab