def test_none_user(self): request = RequestFactory().get("/") request.session = {} request.access = NoAccess() result = self.endpoint.get_projects(request, self.org) assert [] == result request.user = None result = self.endpoint.get_projects(request, self.org) assert [] == result
def serialize_detailed_org(context, obj): if "request" in context: user = context["request"].user access = from_user(user, obj) else: user = None access = NoAccess() context = serialize_func( obj, user, DetailedOrganizationSerializerWithProjectsAndTeams(), access=access ) return convert_to_json(context)
def serialize_detailed_org(context, obj): if 'request' in context: user = context['request'].user access = from_user(user, obj) else: user = None access = NoAccess() context = serialize_func(obj, user, DetailedOrganizationSerializer(), access=access) return convert_to_json(context)