Пример #1
0
 def test_generate_json(self):
     results = self.make_results()
     reporter = Reporter(bundle="git", results=results, options=None)
     with NamedTemporaryFile() as json_file:
         json_result = reporter.generate_json(output_file=json_file.name)
         json_result = json.loads(json_result)
         content = json_file.read()
     for result in json_result["results"]:
         self.assertItemsEqual(result.keys(), ["info", "test_outcome", "tests", "provider_name", "benchmarks"])
         self.assertIn(result["provider_name"], ["aws", "joyent"])
         for test in result["tests"]:
             self.assertIn(test["name"], ["charm-proof", "00-setup", "10-actions"])
             self.assertItemsEqual(test.keys(), ["duration", "output", "suite", "name", "result"])
     self.assertIn('"name": "charm-proof"', content)
Пример #2
0
 def test_generate_json(self):
     results = self.make_results()
     reporter = Reporter(bundle='git', results=results, options=None)
     with NamedTemporaryFile() as json_file:
         json_result = reporter.generate_json(output_file=json_file.name)
         json_result = json.loads(json_result)
         content = json_file.read()
     for result in json_result["results"]:
         self.assertItemsEqual(
             result.keys(),
             ['info', 'test_outcome', 'tests', 'provider_name',
              'benchmarks'])
         self.assertIn(result["provider_name"], ['aws', 'joyent'])
         for test in result["tests"]:
             self.assertIn(
                 test["name"], ['charm-proof', '00-setup', '10-actions'])
             self.assertItemsEqual(
                 test.keys(),
                 ['duration', 'output', 'suite', 'name', 'result'])
     self.assertIn('"name": "charm-proof"', content)