@pytest.mark.django_db
def test_user_has_manager_permissions(no_perms_user, administrate, tp0):
 language0 = tp0.language
 project0 = tp0.project
 assert (not no_perms_user.has_manager_permissions())
 criteria = {'user': no_perms_user, 'directory': tp0.directory}
 ps = PermissionSet.objects.get_or_create(**criteria)[0]
 ps.positive_permissions.set([administrate])
 ps.save()
 assert no_perms_user.has_manager_permissions()
 ps.positive_permissions.clear()
 assert (not no_perms_user.has_manager_permissions())
 criteria['directory'] = language0.directory
 ps = PermissionSet.objects.get_or_create(**criteria)[0]
 ps.positive_permissions.set([administrate])
 ps.save()
 assert no_perms_user.has_manager_permissions()
 ps.positive_permissions.clear()
 assert (not no_perms_user.has_manager_permissions())
 criteria['directory'] = project0.directory
 ps = PermissionSet.objects.get_or_create(**criteria)[0]
 ps.positive_permissions.set([administrate])
 ps.save()
 assert no_perms_user.has_manager_permissions()
 ps.positive_permissions.clear()
 assert (not no_perms_user.has_manager_permissions())

@ pytest . mark . django_db def test_user_has_manager_permissions ( no_perms_user , administrate , tp0 ) : language0 = tp0 . language project0 = tp0 . project assert ( not no_perms_user . has_manager_permissions ( ) ) criteria = { 'user' : no_perms_user , 'directory' : tp0 . directory } ps = PermissionSet . objects . get_or_create ( ** criteria ) [ 0 ] ps . positive_permissions . set ( [ administrate ] ) ps . save ( ) assert no_perms_user . has_manager_permissions ( ) ps . positive_permissions . clear ( ) assert ( not no_perms_user . has_manager_permissions ( ) ) criteria [ 'directory' ] = language0 . directory ps = PermissionSet . objects . get_or_create ( ** criteria ) [ 0 ] ps . positive_permissions . set ( [ administrate ] ) ps . save ( ) assert no_perms_user . has_manager_permissions ( ) ps . positive_permissions . clear ( ) assert ( not no_perms_user . has_manager_permissions ( ) ) criteria [ 'directory' ] = project0 . directory ps = PermissionSet . objects . get_or_create ( ** criteria ) [ 0 ] ps . positive_permissions . set ( [ administrate ] ) ps . save ( ) assert no_perms_user . has_manager_permissions ( ) ps . positive_permissions . clear ( ) assert ( not no_perms_user . has_manager_permissions ( ) )
test user has_manager_permissions method .