mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-16 19:15:16 +00:00
Adds test for query that creates bookwyrm export query
This commit is contained in:
parent
b84ca3d03f
commit
9984e853e5
1 changed files with 11 additions and 0 deletions
|
@ -5,13 +5,16 @@ import pathlib
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.db import connection
|
||||
from django.utils import timezone
|
||||
from django.test import TestCase
|
||||
|
||||
from bookwyrm import models
|
||||
from bookwyrm.tests.query_logger import QueryLogger, raise_long_query_runtime
|
||||
from bookwyrm.utils.tar import BookwyrmTarFile
|
||||
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
class BookwyrmExportJob(TestCase):
|
||||
"""testing user export functions"""
|
||||
|
||||
|
@ -159,6 +162,14 @@ class BookwyrmExportJob(TestCase):
|
|||
models.bookwyrm_export_job.create_export_json_task(job_id=self.job.id)
|
||||
self.job.refresh_from_db()
|
||||
|
||||
def test_create_export_job_query_time(self):
|
||||
"""test the creation of the job"""
|
||||
query_logger = QueryLogger()
|
||||
with connection.execute_wrapper(query_logger):
|
||||
with patch("bookwyrm.models.bookwyrm_export_job.create_archive_task.delay"):
|
||||
models.bookwyrm_export_job.create_export_json_task(job_id=self.job.id)
|
||||
raise_long_query_runtime(query_logger.queries)
|
||||
|
||||
def test_add_book_to_user_export_job(self):
|
||||
"""does AddBookToUserExportJob ...add the book to the export?"""
|
||||
self.assertIsNotNone(self.job.export_json["books"])
|
||||
|
|
Loading…
Reference in a new issue