Exemplo n.º 1
0
 def testInvalidFilesFail(self):
     # just one test file for now
     msg = ''
     frag = 'amendment-incomplete.json'
     inp = pathmap.amendment_obj(frag)
     aa = validate_amendment(inp)
     if len(aa) > 0:
         errors = aa[0]
         if len(errors) == 0:
             ofn = pathmap.amendment_source_path(frag + '.output')
             testing_write_json(errors, ofn)
             msg = "Failed to reject invalid file (no errors found)"
             self.assertTrue(False, msg)
Exemplo n.º 2
0
 def testValidFilesPass(self):
     # just one test file for now
     msg = ''
     frag = 'amendment-good.json'
     amendment = pathmap.amendment_obj(frag)
     aa = validate_amendment(amendment)
     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.amendment_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)
Exemplo n.º 3
0
 def testInvalidDOIsFail(self):
     # all DOIs should be in URL form
     msg = ''
     frag = 'amendment-bad-dois.json'
     inp = pathmap.amendment_obj(frag)
     aa = validate_amendment(inp)
     if len(aa) > 0:
         errors = aa[0]
         ofn = pathmap.amendment_source_path(frag + '.output')
         testing_write_json(errors, ofn)
         if len(errors) == 0:
             msg = "Failed to reject bare DOI (no errors found)"
             self.assertTrue(False, msg)
         else:
             self.assertTrue('should be a URL' in errors[0])