def testValidFilesPass(self):
     # just one test file for now
     msg = ''
     frag = 'collection-good.json'
     collection = pathmap.collection_obj(frag)
     aa = validate_collection(collection)
     errors = aa[0]
     for e in errors:
         _LOG.debug('unexpected error from {f}: {m}'.format(f=frag, m=UNICODE(e)))
     if len(errors) > 0:
         ofn = pathmap.collection_source_path(frag + '.output')
         testing_write_json(errors, ofn)
         msg = "File failed to validate cleanly. See {o}".format(o=ofn)
     self.assertEqual(len(errors), 0, msg)
Пример #2
0
 def testValidFilesPass(self):
     # just one test file for now
     msg = ''
     frag = 'collection-good.json'
     collection = pathmap.collection_obj(frag)
     aa = validate_collection(collection)
     errors = aa[0]
     for e in errors:
         _LOG.debug('unexpected error from {f}: {m}'.format(f=frag,
                                                            m=UNICODE(e)))
     if len(errors) > 0:
         ofn = pathmap.collection_source_path(frag + '.output')
         testing_write_json(errors, ofn)
         msg = "File failed to validate cleanly. See {o}".format(o=ofn)
     self.assertEqual(len(errors), 0, msg)
 def testInvalidFilesFail(self):
     # just one test file for now
     msg = ''
     frag = 'collection-incomplete.json'
     inp = pathmap.collection_obj(frag)
     try:
         aa = validate_collection(inp)
         if len(aa) > 0:
             errors = aa[0]
             if len(errors) == 0:
                 ofn = pathmap.collection_source_path(frag + '.output')
                 testing_write_json(errors, ofn)
                 msg = "Failed to reject file. See {o}".format(o=str(msg))
                 self.assertTrue(False, msg)
     except:
         pass
Пример #4
0
 def testInvalidFilesFail(self):
     # just one test file for now
     msg = ''
     frag = 'collection-incomplete.json'
     inp = pathmap.collection_obj(frag)
     try:
         aa = validate_collection(inp)
         if len(aa) > 0:
             errors = aa[0]
             if len(errors) == 0:
                 ofn = pathmap.collection_source_path(frag + '.output')
                 testing_write_json(errors, ofn)
                 msg = "Failed to reject file. See {o}".format(o=str(msg))
                 self.assertTrue(False, msg)
     except:
         pass