From 62b5a00102935b9dd642954ddc0ea3109c641105 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 26 Jun 2021 13:13:12 -0700 Subject: [PATCH] Adds test mocks from psql tests --- bookwyrm/tests/test_postgres.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bookwyrm/tests/test_postgres.py b/bookwyrm/tests/test_postgres.py index 423eb1131..a597ce604 100644 --- a/bookwyrm/tests/test_postgres.py +++ b/bookwyrm/tests/test_postgres.py @@ -1,19 +1,20 @@ """ django configuration of postgres """ +from unittest import patch from django.test import TestCase from bookwyrm import models - +@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") class PostgresTriggers(TestCase): """special migrations, fancy stuff ya know""" - def test_search_vector_on_create(self): + def test_search_vector_on_create(self, _): """make sure that search_vector is being set correctly on create""" book = models.Edition.objects.create(title="The Long Goodbye") book.refresh_from_db() self.assertEqual(book.search_vector, "'goodby':3A 'long':2A") - def test_search_vector_on_update(self): + def test_search_vector_on_update(self, _): """make sure that search_vector is being set correctly on edit""" book = models.Edition.objects.create(title="The Long Goodbye") book.title = "The Even Longer Goodbye" @@ -21,7 +22,7 @@ class PostgresTriggers(TestCase): book.refresh_from_db() self.assertEqual(book.search_vector, "'even':2A 'goodby':4A 'longer':3A") - def test_search_vector_fields(self): + def test_search_vector_fields(self, _): """use multiple fields to create search vector""" author = models.Author.objects.create(name="The Rays") book = models.Edition.objects.create( @@ -37,7 +38,7 @@ class PostgresTriggers(TestCase): "'cool':5B 'goodby':3A 'long':2A 'name':9 'rays':7B 'seri':8 'the':6B 'wow':4B", ) - def test_seach_vector_on_author_update(self): + def test_seach_vector_on_author_update(self, _): """update search when an author name changes""" author = models.Author.objects.create(name="The Rays") book = models.Edition.objects.create( @@ -50,7 +51,7 @@ class PostgresTriggers(TestCase): self.assertEqual(book.search_vector, "'goodby':3A 'jeremy':4B 'long':2A") - def test_seach_vector_on_author_delete(self): + def test_seach_vector_on_author_delete(self, _): """update search when an author name changes""" author = models.Author.objects.create(name="Jeremy") book = models.Edition.objects.create( @@ -65,7 +66,7 @@ class PostgresTriggers(TestCase): book.refresh_from_db() self.assertEqual(book.search_vector, "'goodby':3A 'long':2A") - def test_search_vector_stop_word_fallback(self): + def test_search_vector_stop_word_fallback(self, _): """use a fallback when removing stop words leads to an empty vector""" book = models.Edition.objects.create( title="there there",