2021-01-15 23:57:57 +00:00
|
|
|
from django.test import TestCase
|
|
|
|
|
|
|
|
from bookmarks.models import Bookmark
|
|
|
|
|
|
|
|
|
|
|
|
class BookmarkTestCase(TestCase):
|
|
|
|
|
|
|
|
def test_bookmark_resolved_title(self):
|
2024-01-27 10:29:16 +00:00
|
|
|
bookmark = Bookmark(
|
|
|
|
title="Custom title",
|
|
|
|
website_title="Website title",
|
|
|
|
url="https://example.com",
|
|
|
|
)
|
|
|
|
self.assertEqual(bookmark.resolved_title, "Custom title")
|
2021-01-15 23:57:57 +00:00
|
|
|
|
2024-01-27 10:29:16 +00:00
|
|
|
bookmark = Bookmark(
|
|
|
|
title="", website_title="Website title", url="https://example.com"
|
|
|
|
)
|
|
|
|
self.assertEqual(bookmark.resolved_title, "Website title")
|
2021-01-15 23:57:57 +00:00
|
|
|
|
2024-01-27 10:29:16 +00:00
|
|
|
bookmark = Bookmark(title="", website_title="", url="https://example.com")
|
|
|
|
self.assertEqual(bookmark.resolved_title, "https://example.com")
|