mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 21:31:56 +02:00
Added follow model and factory
This commit is contained in:
parent
6aa6f1d8f8
commit
f19418d2c2
7 changed files with 99 additions and 2 deletions
25
api/tests/federation/test_models.py
Normal file
25
api/tests/federation/test_models.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import pytest
|
||||
|
||||
from django import db
|
||||
|
||||
from funkwhale_api.federation import models
|
||||
|
||||
|
||||
def test_cannot_duplicate_actor(factories):
|
||||
actor = factories['federation.Actor']()
|
||||
|
||||
with pytest.raises(db.IntegrityError):
|
||||
factories['federation.Actor'](
|
||||
domain=actor.domain,
|
||||
preferred_username=actor.preferred_username,
|
||||
)
|
||||
|
||||
|
||||
def test_cannot_duplicate_follow(factories):
|
||||
follow = factories['federation.Follow']()
|
||||
|
||||
with pytest.raises(db.IntegrityError):
|
||||
factories['federation.Follow'](
|
||||
target=follow.target,
|
||||
actor=follow.actor,
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue