diff --git a/src/backend/marsha/core/simple_jwt/factories.py b/src/backend/marsha/core/simple_jwt/factories.py index 7eb90857e3..2dea956228 100644 --- a/src/backend/marsha/core/simple_jwt/factories.py +++ b/src/backend/marsha/core/simple_jwt/factories.py @@ -3,10 +3,10 @@ import uuid from django.conf import settings -from rest_framework_simplejwt.exceptions import TokenError import factory from faker.utils.text import slugify +from rest_framework_simplejwt.exceptions import TokenError from marsha.core.factories import ( ConsumerSiteFactory, @@ -141,13 +141,13 @@ class BaseResourceTokenFactory(BaseTokenFactory): """ @staticmethod - def get_playlist_id(o): - """Get the playlist id from the resource.""" + def get_playlist_id(params): + """Ensure the resource is a playlist.""" resource_id = uuid.uuid4() - if not o.resource: + if not params.resource: pass - elif isinstance(o.resource, Playlist): - resource_id = o.resource.id + elif isinstance(params.resource, Playlist): + resource_id = params.resource.id else: raise TokenError("resource is not a playlist")