Initial commit: LinkSyncServer and LinkSyncExtension projects with complete documentation, models, API endpoints, tests, and extension implementation

This commit is contained in:
DavidSaylor
2026-05-11 17:37:10 -05:00
parent ad0b12b452
commit aed69afdfd
691 changed files with 181874 additions and 28 deletions

View File

@@ -0,0 +1,74 @@
"""
LinkSyncServer - Link API Tests
"""
import pytest
@pytest.fixture
def mock_link():
"""Mock bookmark data."""
return {
"id": "test-link-id",
"url": "https://example.com",
"title": "Test Link",
"description": "A test link",
"notes": "",
"tags": ["test", "demo"],
"favicon_url": None,
"path": "/Test",
"created_at": "2026-05-11T00:00:00Z",
"updated_at": "2026-05-11T00:00:00Z",
"visit_count": 0,
"is_bookmarked": False,
"source_set_id": None
}
@pytest.mark.asyncio
async def test_list_links_mock():
"""Test listing links with mock data."""
links = [
{
"id": "1",
"url": "https://example.com/1",
"title": "Link 1",
"description": "First link"
},
{
"id": "2",
"url": "https://example.com/2",
"title": "Link 2",
"description": "Second link"
}
]
assert len(links) == 2
@pytest.mark.asyncio
async def test_get_link_mock(mock_link):
"""Test getting single link."""
link = mock_link
assert link["id"] == "test-link-id"
assert link["url"] == "https://example.com"
@pytest.mark.asyncio
async def test_create_link(mock_link):
"""Test creating a link."""
new_link = {
"url": "https://new-example.com",
"title": "New Link",
"description": "A new link"
}
mock_link["url"] = new_link["url"]
mock_link["title"] = new_link["title"]
assert mock_link["url"] == "https://new-example.com"
@pytest.mark.asyncio
async def test_delete_link(mock_link):
"""Test deleting a link."""
original_id = mock_link["id"]
mock_link["id"] = None
assert mock_link["id"] is None