def test_fp_cmd2(): for pair in FP_SUCCESS_PAIRS: args = ['', '-p', pair['passwd'], '-k', pair['key'], '--flower'] with StringIO() as dummy_stdout: with mock.patch.object(sys, 'stdout', dummy_stdout): with mock.patch.object(sys, 'argv', args): psychopass_main() assert pair['result'] + '\n' == dummy_stdout.getvalue()
def test_psy_cmd(): for pair in PSY_SUCCESS_PAIRS: args = ['', '-p', pair['passwd'], '-k', pair['key'], '-l', str(pair['length']), ] pair['special_chars'] or args.append('--no-special-chars') with StringIO() as dummy_stdout: with mock.patch.object(sys, 'stdout', dummy_stdout): with mock.patch.object(sys, 'argv', args): psychopass_main() assert pair['result'] + '\n' == dummy_stdout.getvalue()