File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ def get_algorithm_support(xmlsec):
4242 pof .wait ()
4343
4444 if not p_err :
45- p = p_out .split ( ' \n ' )
45+ p = p_out .splitlines ( )
4646 algs = [x .strip ('"' ) for x in p [1 ].split (',' )]
4747 digest = []
4848 signing = []
Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ def parse_xmlsec_output(output):
586586 :param output: The output from Popen
587587 :return: A boolean; True if the command was a success otherwise False
588588 """
589- for line in output .split ( " \n " ):
589+ for line in output .splitlines ( ):
590590 if line == "OK" :
591591 return True
592592 elif line == "FAIL" :
Original file line number Diff line number Diff line change @@ -540,6 +540,19 @@ def test_sha256_signing():
540540 assert s
541541
542542
543+ def test_xmlsec_output_line_parsing ():
544+ output1 = "prefix\n OK\n postfix"
545+ assert sigver .parse_xmlsec_output (output1 )
546+
547+ output2 = "prefix\n FAIL\n postfix"
548+ raises (sigver .XmlsecError , sigver .parse_xmlsec_output , output2 )
549+
550+ output3 = "prefix\r \n OK\r \n postfix"
551+ assert sigver .parse_xmlsec_output (output3 )
552+
553+ output4 = "prefix\r \n FAIL\r \n postfix"
554+ raises (sigver .XmlsecError , sigver .parse_xmlsec_output , output4 )
555+
543556
544557if __name__ == "__main__" :
545558 # t = TestSecurity()
You can’t perform that action at this time.
0 commit comments