本文整理汇总了Python中reporter.Reporter.generate方法的典型用法代码示例。如果您正苦于以下问题:Python Reporter.generate方法的具体用法?Python Reporter.generate怎么用?Python Reporter.generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reporter.Reporter
的用法示例。
在下文中一共展示了Reporter.generate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_report
# 需要导入模块: from reporter import Reporter [as 别名]
# 或者: from reporter.Reporter import generate [as 别名]
def generate_report(bundle, results, options, status, html_filename,
json_filename):
bundle_yaml = get_bundle_yaml(status)
reporter = Reporter(bundle=bundle, results=results, options=options,
bundle_yaml=bundle_yaml)
reporter.generate(html_filename=html_filename,
json_filename=json_filename)
示例2: test_generate_with_svg
# 需要导入模块: from reporter import Reporter [as 别名]
# 或者: from reporter.Reporter import generate [as 别名]
def test_generate_with_svg(self):
tempdir = mkdtemp()
json_file = os.path.join(tempdir, 'file.json')
html_file = os.path.join(tempdir, 'file.html')
svg_file = os.path.join(tempdir, 'file.svg')
results = self.make_results()
fake_request = FakeRequest()
args = self.make_args()
reporter = Reporter(bundle='git', results=results, options=args,
bundle_yaml='bundle content')
with patch('reporter.requests.post',
autospec=True, return_value=fake_request) as mock_r:
reporter.generate(html_filename=html_file, json_filename=json_file)
mock_r.assert_called_once_with('http://svg.juju.solutions',
'bundle content')
with open(json_file) as fp:
json_content = json.loads(fp.read())
with open(html_file) as fp:
html_content = fp.read()
with open(svg_file) as fp:
svg_content = fp.read()
self.assertIn('charm-proof', html_content)
self.assertEqual(json_content["bundle"]["name"], 'git')
self.assertEqual(json_content["test_id"], '1234')
self.assertEqual(svg_content, 'svg content')
rmtree(tempdir)
示例3: test_generate
# 需要导入模块: from reporter import Reporter [as 别名]
# 或者: from reporter.Reporter import generate [as 别名]
def test_generate(self):
results = self.make_results()
reporter = Reporter(bundle='git', results=results, options=None)
with NamedTemporaryFile() as json_file:
with NamedTemporaryFile() as html_file:
reporter.generate(
html_filename=html_file.name, json_filename=json_file.name)
json_content = json_file.read()
html_content = html_file.read()
json_content = json.loads(json_content)
self.assertIn('charm-proof', html_content)
self.assertEqual(json_content["bundle"]["name"], 'git')