Skip to content
Snippets Groups Projects
Select Git revision
  • develop default protected
  • master
  • 594-navigation-redesign
  • vuln-testing
  • plugins-v2
  • limit-album-tracks
  • 925-flac-transcoding
  • 865-sql-optimization
  • 890-notification
  • 839-donation-link
  • landing-page
  • plugins
  • add-new-shortcuts
  • 735-table-truncate
  • webdav
  • live-streaming
  • 0.20.1
  • 0.20.0
  • 0.20.0-rc1
  • 0.19.1
  • 0.19.0
  • 0.19.0-rc2
  • 0.19.0-rc1
  • 0.18.3
  • 0.18.2
  • 0.18.1
  • 0.18
  • 0.17
  • 0.16.3
  • 0.16.2
  • 0.16.1
  • 0.16
  • 0.15
  • 0.14.2
  • 0.14.1
  • 0.14
36 results

test_fields.py

Blame
  • Forked from funkwhale / funkwhale
    7520 commits behind the upstream repository.
    test_fields.py 516 B
    import pytest
    
    from django.contrib.auth.models import AnonymousUser
    from django.db.models import Q
    
    from funkwhale_api.common import fields
    from funkwhale_api.users.factories import UserFactory
    
    
    @pytest.mark.parametrize('user,expected', [
        (AnonymousUser(), Q(privacy_level='everyone')),
        (UserFactory.build(pk=1),
         Q(privacy_level__in=['me', 'followers', 'instance', 'everyone'])),
    ])
    def test_privacy_level_query(user,expected):
        query = fields.privacy_level_query(user)
        assert query == expected