From 495df36a7748739a3fbd3b56d9a77c5abb6b1f05 Mon Sep 17 00:00:00 2001
From: Lars Eggert <lars@eggert.org>
Date: Tue, 12 Jul 2022 09:18:52 -0700
Subject: [PATCH] chore: Make newer bibtexparser versions work with the tests
 (#4205)

* chore: Make newer bibtexparser versions work with the tests

* Fix test
---
 ietf/doc/tests.py | 8 ++++----
 requirements.txt  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py
index 32ec80acc..77a8eee78 100644
--- a/ietf/doc/tests.py
+++ b/ietf/doc/tests.py
@@ -1828,7 +1828,7 @@ class DocTestCase(TestCase):
         self.assertNotContains(r, "Request publication")
 
     def _parse_bibtex_response(self, response) -> dict:
-        parser = bibtexparser.bparser.BibTexParser()
+        parser = bibtexparser.bparser.BibTexParser(common_strings=True)
         parser.homogenise_fields = False  # do not modify field names (e.g., turns "url" into "link" by default)
         return bibtexparser.loads(response.content.decode(), parser=parser).get_entry_dict()
 
@@ -1850,7 +1850,7 @@ class DocTestCase(TestCase):
         self.assertEqual(entry['number'],   num)
         self.assertEqual(entry['doi'],      '10.17487/RFC%s'%num)
         self.assertEqual(entry['year'],     '2010')
-        self.assertEqual(entry['month'],    'oct')
+        self.assertEqual(entry['month'].lower()[0:3], 'oct')
         self.assertEqual(entry['url'],      f'https://www.rfc-editor.ietf.org/info/rfc{num}')
         #
         self.assertNotIn('day', entry)
@@ -1872,7 +1872,7 @@ class DocTestCase(TestCase):
         self.assertEqual(entry['number'],   num)
         self.assertEqual(entry['doi'],      '10.17487/RFC%s'%num)
         self.assertEqual(entry['year'],     '1990')
-        self.assertEqual(entry['month'],    'apr')
+        self.assertEqual(entry['month'].lower()[0:3],    'apr')
         self.assertEqual(entry['day'],      '1')
         self.assertEqual(entry['url'],      f'https://www.rfc-editor.ietf.org/info/rfc{num}')
 
@@ -1885,7 +1885,7 @@ class DocTestCase(TestCase):
         self.assertEqual(entry['note'],     'Work in Progress')
         self.assertEqual(entry['number'],   docname)
         self.assertEqual(entry['year'],     str(draft.pub_date().year))
-        self.assertEqual(entry['month'],    draft.pub_date().strftime('%b').lower())
+        self.assertEqual(entry['month'].lower()[0:3],    draft.pub_date().strftime('%b').lower())
         self.assertEqual(entry['day'],      str(draft.pub_date().day))
         self.assertEqual(entry['url'],      settings.IDTRACKER_BASE_URL + urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=draft.rev)))
         #
diff --git a/requirements.txt b/requirements.txt
index 31e0043da..453538331 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,7 +3,7 @@ setuptools>=51.1.0    # Require this first, to prevent later errors
 #
 argon2-cffi>=21.3.0    # For the Argon2 password hasher option
 beautifulsoup4>=4.11.1    # Only used in tests
-bibtexparser>=0.6.2,<1.0    # Only used in tests. Version 1.0 doesn't work under python 2.7.  1.0.1 doesn't recognize month names or abbreviations.
+bibtexparser>=1.2.0    # Only used in tests
 bleach>=5.0.0
 coverage>=4.5.4,<5.0    # Coverage 5.x moves from a json database to SQLite.  Moving to 5.x will require substantial rewrites in ietf.utils.test_runner and ietf.release.views
 decorator>=5.1.1