forked from mirrors/bookwyrm
Updates tests that reference self_connector
This commit is contained in:
parent
1033d3d045
commit
92f9319fe1
5 changed files with 8 additions and 37 deletions
|
@ -12,7 +12,6 @@ import responses
|
|||
from bookwyrm import models
|
||||
from bookwyrm.importers import GoodreadsImporter
|
||||
from bookwyrm.importers.importer import import_data, handle_imported_book
|
||||
from bookwyrm.settings import DOMAIN
|
||||
|
||||
|
||||
def make_date(*args):
|
||||
|
@ -39,16 +38,6 @@ class GoodreadsImport(TestCase):
|
|||
"mouse", "mouse@mouse.mouse", "password", local=True
|
||||
)
|
||||
|
||||
models.Connector.objects.create(
|
||||
identifier=DOMAIN,
|
||||
name="Local",
|
||||
connector_file="self_connector",
|
||||
base_url="https://%s" % DOMAIN,
|
||||
books_url="https://%s/book" % DOMAIN,
|
||||
covers_url="https://%s/images/covers" % DOMAIN,
|
||||
search_url="https://%s/search?q=" % DOMAIN,
|
||||
priority=1,
|
||||
)
|
||||
work = models.Work.objects.create(title="Test Work")
|
||||
self.book = models.Edition.objects.create(
|
||||
title="Example Edition",
|
||||
|
@ -124,7 +113,7 @@ class GoodreadsImport(TestCase):
|
|||
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/goodreads.csv")
|
||||
csv_file = open(datafile, "r")
|
||||
csv_file = open(datafile, "r") # pylint: disable=unspecified-encoding
|
||||
for index, entry in enumerate(list(csv.DictReader(csv_file))):
|
||||
entry = self.importer.parse_fields(entry)
|
||||
import_item = models.ImportItem.objects.create(
|
||||
|
@ -161,7 +150,7 @@ class GoodreadsImport(TestCase):
|
|||
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/goodreads.csv")
|
||||
csv_file = open(datafile, "r")
|
||||
csv_file = open(datafile, "r") # pylint: disable=unspecified-encoding
|
||||
for index, entry in enumerate(list(csv.DictReader(csv_file))):
|
||||
entry = self.importer.parse_fields(entry)
|
||||
import_item = models.ImportItem.objects.create(
|
||||
|
@ -191,7 +180,7 @@ class GoodreadsImport(TestCase):
|
|||
shelf = self.user.shelf_set.filter(identifier="read").first()
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/goodreads.csv")
|
||||
csv_file = open(datafile, "r")
|
||||
csv_file = open(datafile, "r") # pylint: disable=unspecified-encoding
|
||||
for index, entry in enumerate(list(csv.DictReader(csv_file))):
|
||||
entry = self.importer.parse_fields(entry)
|
||||
import_item = models.ImportItem.objects.create(
|
||||
|
@ -223,7 +212,7 @@ class GoodreadsImport(TestCase):
|
|||
"""goodreads review import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/goodreads.csv")
|
||||
csv_file = open(datafile, "r")
|
||||
csv_file = open(datafile, "r") # pylint: disable=unspecified-encoding
|
||||
entry = list(csv.DictReader(csv_file))[2]
|
||||
entry = self.importer.parse_fields(entry)
|
||||
import_item = models.ImportItem.objects.create(
|
||||
|
@ -247,7 +236,7 @@ class GoodreadsImport(TestCase):
|
|||
datafile = pathlib.Path(__file__).parent.joinpath(
|
||||
"../data/goodreads-rating.csv"
|
||||
)
|
||||
csv_file = open(datafile, "r")
|
||||
csv_file = open(datafile, "r") # pylint: disable=unspecified-encoding
|
||||
entry = list(csv.DictReader(csv_file))[2]
|
||||
entry = self.importer.parse_fields(entry)
|
||||
import_item = models.ImportItem.objects.create(
|
||||
|
@ -268,7 +257,7 @@ class GoodreadsImport(TestCase):
|
|||
"""goodreads review import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/goodreads.csv")
|
||||
csv_file = open(datafile, "r")
|
||||
csv_file = open(datafile, "r") # pylint: disable=unspecified-encoding
|
||||
entry = list(csv.DictReader(csv_file))[2]
|
||||
entry = self.importer.parse_fields(entry)
|
||||
import_item = models.ImportItem.objects.create(
|
||||
|
|
|
@ -11,7 +11,6 @@ import responses
|
|||
from bookwyrm import models
|
||||
from bookwyrm.importers import LibrarythingImporter
|
||||
from bookwyrm.importers.importer import import_data, handle_imported_book
|
||||
from bookwyrm.settings import DOMAIN
|
||||
|
||||
|
||||
def make_date(*args):
|
||||
|
@ -39,17 +38,6 @@ class LibrarythingImport(TestCase):
|
|||
self.user = models.User.objects.create_user(
|
||||
"mmai", "mmai@mmai.mmai", "password", local=True
|
||||
)
|
||||
|
||||
models.Connector.objects.create(
|
||||
identifier=DOMAIN,
|
||||
name="Local",
|
||||
connector_file="self_connector",
|
||||
base_url="https://%s" % DOMAIN,
|
||||
books_url="https://%s/book" % DOMAIN,
|
||||
covers_url="https://%s/images/covers" % DOMAIN,
|
||||
search_url="https://%s/search?q=" % DOMAIN,
|
||||
priority=1,
|
||||
)
|
||||
work = models.Work.objects.create(title="Test Work")
|
||||
self.book = models.Edition.objects.create(
|
||||
title="Example Edition",
|
||||
|
|
|
@ -9,8 +9,8 @@ from django.test import TestCase
|
|||
import responses
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.book_search import SearchResult
|
||||
from bookwyrm.connectors import connector_manager
|
||||
from bookwyrm.connectors.abstract_connector import SearchResult
|
||||
|
||||
|
||||
class ImportJob(TestCase):
|
||||
|
|
|
@ -29,9 +29,6 @@ class GetStartedViews(TestCase):
|
|||
title="Example Edition",
|
||||
remote_id="https://example.com/book/1",
|
||||
)
|
||||
models.Connector.objects.create(
|
||||
identifier="self", connector_file="self_connector"
|
||||
)
|
||||
models.SiteSettings.objects.create()
|
||||
|
||||
def test_profile_view(self, *_):
|
||||
|
|
|
@ -34,9 +34,6 @@ class IsbnViews(TestCase):
|
|||
remote_id="https://example.com/book/1",
|
||||
parent_work=self.work,
|
||||
)
|
||||
models.Connector.objects.create(
|
||||
identifier="self", connector_file="self_connector"
|
||||
)
|
||||
models.SiteSettings.objects.create()
|
||||
|
||||
def test_isbn_json_response(self):
|
||||
|
@ -51,4 +48,4 @@ class IsbnViews(TestCase):
|
|||
data = json.loads(response.content)
|
||||
self.assertEqual(len(data), 1)
|
||||
self.assertEqual(data[0]["title"], "Test Book")
|
||||
self.assertEqual(data[0]["key"], "https://%s/book/%d" % (DOMAIN, self.book.id))
|
||||
self.assertEqual(data[0]["key"], f"https://{DOMAIN}/book/{self.book.id}")
|
||||
|
|
Loading…
Reference in a new issue