def test__using_with__no_params(self): with Temp_File() as temp: assert Files.file_extension(temp.file_path) == '.tmp' assert Files.exists(temp.file_path) assert Files.contents(temp.file_path) == '...' assert Files.not_exists(temp.file_path) with Temp_File('abc', 'txt') as temp: assert Files.file_extension(temp.file_path) == '.txt' assert Files.exists(temp.file_path) assert Files.contents(temp.file_path) == 'abc' assert Files.not_exists(temp.file_path)
def json_report(self): from gw_bot.api.gw.Report_Xml_Parser import Report_Xml_Parser test_file = '/tmp/macros.xml-report.xml' xml_report = Files.contents(test_file) parser = Report_Xml_Parser(xml_report) json_report = parser.parse_document() return parser.analysis_report_summary(json_report)
def run(event, context): d = 'digraph {\na -> b[label="hi", decorate];\n}' graph = pydot.graph_from_dot_data(d).pop() node = pydot.Node('AAAAAA', shape="box") graph.add_node(node) #tmp_file = '/tmp/dot_temp.dot' #graph.write(tmp_file) #return Files.contents(tmp_file) # this will excute the actual dot app data = Files.contents('./data/TM_Graph.dot') graph = pydot.graph_from_dot_data(data).pop() node = pydot.Node('aaa', shape="box") graph.add_node(node) graph.add_edge(pydot.Edge('aaa', 'Webserver', label='from aaaa')) filename = '/tmp/test_dot.svg' dot_static = abspath(join('./', 'dot_static')) graph.write_svg(filename, prog=dot_static) return Files.contents(filename)
def screenshot_file(self, html_file, img_file=None, clip=None): return self.screenshot_html(Files.contents(html_file), img_file, clip)
def render_file(self, html_file): return self.render_html(Files.contents(html_file))