mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-07 10:58:25 +02:00
Ensure tag names don't contain spaces (#184)
This commit is contained in:
@@ -2,6 +2,7 @@ from unittest.mock import patch
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
from bookmarks.models import Tag
|
||||
from bookmarks.services import tasks
|
||||
from bookmarks.services.importer import import_netscape_html
|
||||
from bookmarks.tests.helpers import BookmarkFactoryMixin, disable_logging
|
||||
@@ -20,6 +21,18 @@ class ImporterTestCase(TestCase, BookmarkFactoryMixin):
|
||||
</DL><p>
|
||||
'''
|
||||
|
||||
def test_replace_whitespace_in_tag_names(self):
|
||||
test_html = self.create_import_html(f'''
|
||||
<DT><A HREF="https://example.com" ADD_DATE="1616337559" PRIVATE="0" TOREAD="0" TAGS="tag 1, tag 2, tag 3">Example.com</A>
|
||||
<DD>Example.com
|
||||
''')
|
||||
import_netscape_html(test_html, self.get_or_create_test_user())
|
||||
|
||||
tags = Tag.objects.all()
|
||||
tag_names = [tag.name for tag in tags]
|
||||
|
||||
self.assertListEqual(tag_names, ['tag-1', 'tag-2', 'tag-3'])
|
||||
|
||||
@disable_logging
|
||||
def test_validate_empty_or_missing_bookmark_url(self):
|
||||
test_html = self.create_import_html(f'''
|
||||
|
Reference in New Issue
Block a user