mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 10:01:04 +00:00
Merge pull request #2311 from bookwyrm-social/small-tests
Just adds a couple tests
This commit is contained in:
commit
003c5c9c82
1 changed files with 10 additions and 0 deletions
|
@ -14,6 +14,7 @@ from bookwyrm.templatetags import utilities
|
|||
class UtilitiesTags(TestCase):
|
||||
"""lotta different things here"""
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
def setUp(self):
|
||||
"""create some filler objects"""
|
||||
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), patch(
|
||||
|
@ -34,6 +35,7 @@ class UtilitiesTags(TestCase):
|
|||
remote_id="http://example.com/rat",
|
||||
local=False,
|
||||
)
|
||||
self.author = models.Author.objects.create(name="Jessica", isni="4")
|
||||
self.book = models.Edition.objects.create(title="Test Book")
|
||||
|
||||
def test_get_uuid(self, *_):
|
||||
|
@ -77,3 +79,11 @@ class UtilitiesTags(TestCase):
|
|||
value = ValueMock("home/one/two/three/four")
|
||||
self.assertEqual(utilities.truncatepath(value, 2), "home/…ur")
|
||||
self.assertEqual(utilities.truncatepath(value, "a"), "four")
|
||||
|
||||
def test_get_isni_bio(self, *_):
|
||||
"""get ISNI bio"""
|
||||
DataMock = namedtuple("Data", ("bio", "isni"))
|
||||
data = [DataMock(r"One\Dtwo", "4"), DataMock("Not used", "4")]
|
||||
|
||||
result = utilities.get_isni_bio(data, self.author)
|
||||
self.assertEqual(result, "Author of <em>One\\Dtwo</em>")
|
||||
|
|
Loading…
Reference in a new issue