A fork of https://github.com/Synerty/SOAPpy-py3 This is a working tree till fixes get imported upstream.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

75 lines
3.1 KiB

  1. #!/usr/bin/env python
  2. import html
  3. ident = '$Id: interop2html.py 4 2001-06-27 21:36:11Z cullman $'
  4. lines = open('output.txt').readlines()
  5. #preserve the tally
  6. tally = lines[-6:]
  7. #whack the tally from lines
  8. lines = lines[:-6]
  9. table={}
  10. for line in lines:
  11. if line[:3] == ' ' or line == '>\n' : continue
  12. line = line[:-1] #delete end of line char
  13. row = [line[:line.find(': ')], line[line.find(': ')+2:]] #split server name from rest of line
  14. restofrow = row[1].split(' ',3) #break out method name, number, status code, status comment
  15. if len(restofrow) > 3:
  16. if restofrow[3].find('as expected') != -1:
  17. restofrow[2] = restofrow[2] + ' (as expected)'
  18. elif restofrow[3][:2] == '- ' :
  19. restofrow[3] = restofrow[3][2:]
  20. try: table[row[0]].append([restofrow[0],restofrow[2:]])
  21. except KeyError: table[row[0]] = [[restofrow[0],restofrow[2:]]]
  22. print("<html><body>")
  23. print("<script>function popup(text) {")
  24. print("text = '<html><head><title>Test Detail</title></head><body><p>' + text + '</p></body></html>';")
  25. print("newWin=window.open('','win1','location=no,menubar=no,width=400,height=200');")
  26. print("newWin.document.open();")
  27. print("newWin.document.write(text);")
  28. print("newWin.focus(); } </script>")
  29. print("<br><table style='font-family: Arial; color: #cccccc'><tr><td colspan=2><font face=arial color=#cccccc><b>Summary</b></font></td></tr>")
  30. for x in tally:
  31. z = x[:-1].split(":",1)
  32. print("<tr><td><font face=arial color=#cccccc>",z[0],"</font></td><td><font face=arial color=#cccccc>",z[1],"</font></td></tr>")
  33. print("</table><br>")
  34. c = 0
  35. totalmethods = len(table[list(table.keys())[0]])
  36. while c < totalmethods:
  37. print("<br><table width='95%' style='font-family: Arial'>")
  38. print("<tr><td width='27%' bgcolor='#cccccc'></td>")
  39. cols = [c, c + 1, c + 2]
  40. if c != 16:
  41. cols += [c + 3]
  42. for i in cols:
  43. try: header = table[list(table.keys())[0]][i][0]
  44. except: break
  45. print("<td width ='17%' align='center' bgcolor='#cccccc'><b>",header,"</b></td>")
  46. print("</tr>")
  47. l = list(table.keys())
  48. l.sort()
  49. for key in l:
  50. print("<tr><td bgcolor='#cccccc'>", key , "</td>")
  51. for i in cols:
  52. try: status = table[key][i][1][0]
  53. except: break
  54. if status.find("succeed") != -1:
  55. bgcolor = "#339900"
  56. status = "Pass"
  57. elif status.find("expected") != -1:
  58. bgcolor = "#FF9900"
  59. hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties
  60. popuphtml = '"' + html.escape(html.escape(table[key][i][1][1]).replace("'","&#39;").replace('"',"&#34;")) + '"'
  61. status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed (expected)</a>"
  62. else:
  63. bgcolor = "#CC0000"
  64. hreftitle = table[key][i][1][1].replace("'","") # remove apostrophes from title properties
  65. popuphtml = '"' + html.escape(html.escape(table[key][i][1][1]).replace("'","&#39;").replace('"',"&#34;")) + '"'
  66. status = "<a title='" + hreftitle + "' href='javascript:popup(" + popuphtml + ")'>Failed</a>"
  67. print("<td align='center' bgcolor=" , bgcolor , ">" , status , "</td>")
  68. print("</tr>")
  69. print("</table>")
  70. c = c + len(cols)
  71. print("</body></html>")