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.
 
 
 
 

77 lines
3.1 KiB

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