chore: tweaks for rebuild_reference_relations

This commit is contained in:
Robert Sparks 2023-06-26 13:03:59 -05:00
parent 8ff14419c2
commit 69f882d833
No known key found for this signature in database
GPG key ID: 6E2A6A5775F91318
2 changed files with 4 additions and 4 deletions

View file

@ -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'],
}
)

View file

@ -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: