예제 #1
0
 def test_json(self):
   json_output = StringIO()
   json_factory.OutputToJSON(json_output, sort_keys=True, indent=2)(self.record)
   if self.UPDATE_OUTPUT:
     with open(_local_filename('record.json'), 'wb') as jsonfile:
       jsonfile.write(json_output.getvalue())
   else:
     self.assertTrue(data.equals_log_diff(self.json, json_output.getvalue()))
예제 #2
0
 def test_json(self):
     json_output = StringIO()
     json_factory.OutputToJSON(json_output, sort_keys=True,
                               indent=2)(self.record)
     if self.UPDATE_OUTPUT:
         with open(_local_filename('record.json'), 'wb') as jsonfile:
             jsonfile.write(json_output.getvalue())
     else:
         self.assertTrue(
             data.equals_log_diff(self.json, json_output.getvalue()))
예제 #3
0
 def test_testrun(self):
   testrun_output = StringIO()
   mfg_inspector.OutputToTestRunProto(testrun_output)(self.record)
   if self.UPDATE_OUTPUT:
     with open(_local_filename('record.testrun'), 'wb') as testrunfile:
       testrunfile.write(testrun_output.getvalue())
   else:
     actual = test_runs_pb2.TestRun.FromString(testrun_output.getvalue())
     self.assertTrue(data.equals_log_diff(
         text_format.MessageToString(self.testrun),
         text_format.MessageToString(actual)))
예제 #4
0
 def test_testrun(self):
     testrun_output = StringIO()
     mfg_inspector.OutputToTestRunProto(testrun_output)(self.record)
     if self.UPDATE_OUTPUT:
         with open(_local_filename('record.testrun'), 'wb') as testrunfile:
             testrunfile.write(testrun_output.getvalue())
     else:
         actual = test_runs_pb2.TestRun.FromString(
             testrun_output.getvalue())
         self.assertTrue(
             data.equals_log_diff(text_format.MessageToString(self.testrun),
                                  text_format.MessageToString(actual)))