Additional setting to control wether music library federation needs approval

This commit is contained in:
Eliot Berriot 2018-04-02 22:43:59 +02:00
commit a81c92dbf5
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
5 changed files with 50 additions and 1 deletions

View file

@ -197,3 +197,28 @@ def test_getting_actor_instance_persists_in_db(db):
for f in test._meta.fields:
assert getattr(from_db, f.name) == getattr(test, f.name)
@pytest.mark.parametrize('username,domain,expected', [
('test', 'wrongdomain.com', False),
('notsystem', '', False),
('test', '', True),
])
def test_actor_is_system(
username, domain, expected, nodb_factories, settings):
if not domain:
domain = settings.FEDERATION_HOSTNAME
actor = nodb_factories['federation.Actor'](
preferred_username=username,
domain=domain,
)
assert actor.is_system is expected
@pytest.mark.parametrize('value', [False, True])
def test_library_actor_manually_approves_based_on_setting(
value, settings):
settings.FEDERATION_MUSIC_NEEDS_APPROVAL = value
library_conf = actors.SYSTEM_ACTORS['library']
assert library_conf.manually_approves_followers is value