Exemplo n.º 1
0
    if source_file.endswith('.json') or source_file.endswith('.expected'):
      shutil.copy(source_file, dest_file)
      if filename.endswith('.json'):
        testname = os.path.splitext(filename)[0]
        # Make sure that the methods start with test.
        if not testname.startswith('test'):
          testname = 'test' + testname
        # Add a method to JsoncppUnitTest class by calling the
        # _ReturnRunOneTest function.
        setattr(JsoncppUnitTest, testname, _ReturnRunOneTest(json_test,
                                                             dest_file))

def tearDown():
  """Remove the test input and output files in the temporary directory."""
  paths = []
  for pattern in ['*.actual',
                  '*.actual-rewrite',
                  '*.rewrite',
                  '*.json',
                  '*.expected',
                  '*.process-output']:
    paths += glob.glob(FLAGS.test_tmpdir + "/" + pattern)

  for path in paths:
      os.unlink(path)

# ===========================================================================

if __name__ == '__main__':
  googletest.main()
Exemplo n.º 2
0
        super(MatcherTest, self).setUp()
        data_path = os.path.join(TEST_PATH,
                                 'less_compliant_smbios_records.txt')
        data_file = resources.GetResourceFilename(data_path)
        self.records, _ = dmiparse.DmiParser(data_file).parse()
        self.assertLen(self.records, 294)

    def testRecordTypeMatcherMatchesSingleRecord(self):
        matchers = matcher.Matcher(
            [matcher.RecordTypeMatcher(constants.RecordType.BIOS_RECORD)])
        matched_records = []
        for _, record in self.records.items():
            if matchers.is_matched_record(record):
                matched_records.append(record)
        self.assertLen(matched_records, 1)

    def testRecordTypeMatcherMatchesMultipleRecords(self):
        matchers = matcher.Matcher([
            matcher.RecordTypeMatcher(
                constants.RecordType.GROUP_ASSOCIATIONS_RECORD)
        ])
        matched_records = []
        for _, record in self.records.items():
            if matchers.is_matched_record(record):
                matched_records.append(record)
        self.assertLen(matched_records, 3)


if __name__ == '__main__':
    googletest.main()
def main(unused_argv):
    googletest.main()
def main(unused_argv):
  googletest.main()
Exemplo n.º 5
0
def main():
    googletest.main()
Exemplo n.º 6
0
def main():
  googletest.main()
Exemplo n.º 7
0
def main(argv):
  googletest.main()
Exemplo n.º 8
0
def main(argv):
    googletest.main()
Exemplo n.º 9
0
def main():
    flagfile = PrependBase('config.cfg')
    sys.argv.insert(1, '--flagfile=%s' % flagfile)
    googletest.main()