forked from mirrors/bookwyrm
Adds users to base model mock
This commit is contained in:
parent
db4519b2e1
commit
08586e348c
1 changed files with 17 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
""" testing models """
|
""" testing models """
|
||||||
|
from unittest.mock import patch
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from bookwyrm import models
|
from bookwyrm import models
|
||||||
|
@ -9,6 +10,22 @@ from bookwyrm.settings import DOMAIN
|
||||||
class BaseModel(TestCase):
|
class BaseModel(TestCase):
|
||||||
""" functionality shared across models """
|
""" functionality shared across models """
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
""" shared data """
|
||||||
|
self.local_user = models.User.objects.create_user(
|
||||||
|
"mouse", "mouse@mouse.com", "mouseword", local=True, localname="mouse"
|
||||||
|
)
|
||||||
|
with patch("bookwyrm.models.user.set_remote_server.delay"):
|
||||||
|
self.remote_user = models.User.objects.create_user(
|
||||||
|
"rat",
|
||||||
|
"rat@rat.com",
|
||||||
|
"ratword",
|
||||||
|
local=False,
|
||||||
|
remote_id="https://example.com/users/rat",
|
||||||
|
inbox="https://example.com/users/rat/inbox",
|
||||||
|
outbox="https://example.com/users/rat/outbox",
|
||||||
|
)
|
||||||
|
|
||||||
def test_remote_id(self):
|
def test_remote_id(self):
|
||||||
""" these should be generated """
|
""" these should be generated """
|
||||||
instance = base_model.BookWyrmModel()
|
instance = base_model.BookWyrmModel()
|
||||||
|
|
Loading…
Reference in a new issue