From 3cbbc44964fe5f576fef4c598667bccc33b5aba7 Mon Sep 17 00:00:00 2001
From: ulif <uli@gnufix.de>
Date: Sat, 30 Apr 2016 12:39:48 +0200
Subject: [PATCH] Undo changes to "considers_configfile" tests.

The modifications undone here, in
`test_handle_options_considers_configfile()` could have gone into an
own test. Each single test should only test a clear minimum of
things.

This specific test checked, whether configiles are considered at
all. It was not its purpose to examine correct interpretation of
keywords in the .ini-file; only to see whether these keyword values
can be changed at all.

If we wanted a complete and strict checking also of values, we had at
least to check all possible keywords, including 'randomsource' and
'wordlist'. Instead we only check a boolean, int, and string type
keyword.

Therefore the change to `test_handle_options_considers_configfile()`
should have gone to another test.

But then, the added testing is not neccessary. We had a test already
that should have checked the 'caps' value properly. This test was done
wrong before and is now done correctly, thanks to @dwcoder .

I therefore removed the added test functionality.
---
 tests/test_diceware.py | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tests/test_diceware.py b/tests/test_diceware.py
index b983d4c..572f9a5 100644
--- a/tests/test_diceware.py
+++ b/tests/test_diceware.py
@@ -194,7 +194,7 @@ class TestDicewareModule(object):
         assert out == ''
         assert "invalid choice" in err
 
-    def test_handle_options_considers_configfile(self, home_dir, capsys):
+    def test_handle_options_considers_configfile(self, home_dir):
         # defaults from a local configfile are respected
         config_file = home_dir / ".diceware.ini"
         config_file.write("\n".join(
@@ -207,12 +207,6 @@ class TestDicewareModule(object):
         assert options.num == 3
         assert options.delimiter == "my-delim"
         assert options.caps is False
-        # Now test the main program
-        sys.stdin = StringIO("word1\n")
-        sys.argv = ['diceware', '-']
-        main()  # call with default options in place
-        out, err = capsys.readouterr()
-        assert out == 'word1my-delimword1my-delimword1\n'
 
     def test_main(self, capsys):
         # we can get a passphrase
-- 
GitLab