Adds new test file for search

This commit is contained in:
Mouse Reeve
2021-09-30 13:03:04 -07:00
parent 92f9319fe1
commit 3f44389c6b
3 changed files with 119 additions and 15 deletions

View File

@ -3,7 +3,6 @@ from django.test import TestCase
import responses
from bookwyrm import models
from bookwyrm.book_search import SearchResult
from bookwyrm.connectors import abstract_connector
from bookwyrm.connectors.abstract_connector import Mapping
@ -94,19 +93,6 @@ class AbstractConnector(TestCase):
results = self.test_connector.isbn_search("123456")
self.assertEqual(len(results), 10)
def test_search_result(self):
"""a class that stores info about a search result"""
result = SearchResult(
title="Title",
key="https://example.com/book/1",
author="Author Name",
year="1850",
connector=self.test_connector,
)
# there's really not much to test here, it's just a dataclass
self.assertEqual(result.confidence, 1)
self.assertEqual(result.title, "Title")
def test_create_mapping(self):
"""maps remote fields for book data to bookwyrm activitypub fields"""
mapping = Mapping("isbn")