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):
42
42
pof .wait ()
43
43
44
44
if not p_err :
45
- p = p_out .split ( ' \n ' )
45
+ p = p_out .splitlines ( )
46
46
algs = [x .strip ('"' ) for x in p [1 ].split (',' )]
47
47
digest = []
48
48
signing = []
Original file line number Diff line number Diff line change @@ -586,7 +586,7 @@ def parse_xmlsec_output(output):
586
586
:param output: The output from Popen
587
587
:return: A boolean; True if the command was a success otherwise False
588
588
"""
589
- for line in output .split ( " \n " ):
589
+ for line in output .splitlines ( ):
590
590
if line == "OK" :
591
591
return True
592
592
elif line == "FAIL" :
Original file line number Diff line number Diff line change @@ -540,6 +540,19 @@ def test_sha256_signing():
540
540
assert s
541
541
542
542
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
+
543
556
544
557
if __name__ == "__main__" :
545
558
# t = TestSecurity()
You can’t perform that action at this time.
0 commit comments