예제 #1
0
 def test_main_help(self, argv_handler, capsys):
     # we can get help
     sys.argv = ['diceware', '--help']
     with pytest.raises(SystemExit) as exc_info:
         main()
     assert exc_info.value.code == 0
     out, err = capsys.readouterr()
     expected_path = os.path.join(os.path.dirname(__file__),
                                  'exp_help_output.txt')
     with open(expected_path, 'r') as fd:
         expected_output = fd.read()
     wordlists_dir = get_wordlists_dir()
     out = out.replace(wordlists_dir, "<WORDLISTS-DIR>")
     out = out.replace("\n<WORDLISTS-DIR>", " <WORDLISTS-DIR>")
     assert out == expected_output
예제 #2
0
 def test_main_help(self, argv_handler, capsys):
     # we can get help
     sys.argv = ['diceware', '--help']
     with pytest.raises(SystemExit) as exc_info:
         main()
     assert exc_info.value.code == 0
     out, err = capsys.readouterr()
     expected_path = os.path.join(
         os.path.dirname(__file__), 'exp_help_output.txt')
     with open(expected_path, 'r') as fd:
         expected_output = fd.read()
     wordlists_dir = get_wordlists_dir()
     expected_output = expected_output.replace("\n", "")
     out = expected_output.replace("\n", "")
     out = out.replace(wordlists_dir, "<WORDLISTS-DIR>")
     assert out == expected_output