Added a test case for reference extraction.

- Legacy-Id: 14869
This commit is contained in:
Henrik Levkowetz 2018-03-20 11:04:12 +00:00
parent c8961381ab
commit b75ee89865
2 changed files with 48 additions and 0 deletions

View file

@ -178,6 +178,35 @@ Table of Contents
No new registrations for IANA.
[RFC8175] is mentioned here in order to give the reference
classification code a chance to mess up.
6. References
6.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>.
6.2. Informative References
[RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for
Writing an IANA Considerations Section in RFCs", BCP 26,
RFC 8126, DOI 10.17487/RFC8126, June 2017,
<https://www.rfc-editor.org/info/rfc8126>.
[RFC8175] Ratliff, S., Jury, S., Satterwhite, D., Taylor, R., and B.
Berry, "Dynamic Link Exchange Protocol (DLEP)", RFC 8175,
DOI 10.17487/RFC8175, June 2017,
<https://www.rfc-editor.org/info/rfc8175>.
Author's Address
%(author)s
@ -190,6 +219,10 @@ Author's Address
Appendix A. Comments
[RFC8174] is mentioned here just to give the reference classification
code a chance to mess up.

View file

@ -35,6 +35,7 @@ from ietf.utils.mail import outbox, empty_outbox
from ietf.utils.models import VersionInfo
from ietf.utils.test_data import make_test_data
from ietf.utils.test_utils import login_testing_unauthorized, unicontent, TestCase
from ietf.utils.draft import Draft
def submission_file(name, rev, group, format, templatename, author=None, email=None, title=None, year=None, ascii=True):
@ -1660,3 +1661,17 @@ class ApiSubmitTests(TestCase):
r, author, name = self.post_submission('00', year="1900")
expected = "Document date must be within 3 days of submission date"
self.assertContains(r, expected, status_code=400)
class RefsTests(TestCase):
def test_draft_refs_identification(self):
group = None
file, __ = submission_file('draft-some-subject', '00', group, 'txt', "test_submission.txt", )
draft = Draft(file.read().decode('utf-8'), file.name)
refs = draft.get_refs()
self.assertEqual(refs['rfc2119'], 'norm')
self.assertEqual(refs['rfc8174'], 'norm')
self.assertEqual(refs['rfc8126'], 'info')
self.assertEqual(refs['rfc8175'], 'info')