chore: tweaks for rebuild_reference_relations
This commit is contained in:
parent
8ff14419c2
commit
69f882d833
|
@ -325,7 +325,7 @@ class RebuildReferenceRelationsTests(TestCase):
|
|||
super().setUp()
|
||||
self.doc = WgDraftFactory() # document under test
|
||||
# Other documents that should be found by rebuild_reference_relations
|
||||
self.normative, self.informative, self.unknown = WgRfcFactory.create_batch(3)
|
||||
self.normative, self.informative, self.unknown = WgRfcFactory.create_batch(3) # AMHERE - these need to have rfc names.
|
||||
for relationship in ['refnorm', 'refinfo', 'refunk', 'refold']:
|
||||
self.doc.relateddocument_set.create(
|
||||
target=WgRfcFactory(),
|
||||
|
@ -409,7 +409,7 @@ class RebuildReferenceRelationsTests(TestCase):
|
|||
self.assertEqual(
|
||||
result,
|
||||
{
|
||||
'warnings': ['There were 1 references with no matching DocAlias'],
|
||||
'warnings': ['There were 1 references with no matching Document'],
|
||||
'unfound': ['draft-not-found'],
|
||||
}
|
||||
)
|
||||
|
|
|
@ -780,13 +780,13 @@ def rebuild_reference_relations(doc, filenames):
|
|||
unfound.add( "%s" % ref )
|
||||
continue
|
||||
elif count > 1:
|
||||
errors.append("Too many DocAlias objects found for %s"%ref)
|
||||
errors.append("Too many Document objects found for %s"%ref)
|
||||
else:
|
||||
# Don't add references to ourself
|
||||
if doc != refdoc[0]:
|
||||
RelatedDocument.objects.get_or_create( source=doc, target=refdoc[ 0 ], relationship=DocRelationshipName.objects.get( slug='ref%s' % refType ) )
|
||||
if unfound:
|
||||
warnings.append('There were %d references with no matching DocAlias'%len(unfound))
|
||||
warnings.append('There were %d references with no matching Document'%len(unfound))
|
||||
|
||||
ret = {}
|
||||
if errors:
|
||||
|
|
Loading…
Reference in a new issue