From 4f906b362c5ae8f6fd4cc75ffef2e283830bb2bf Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Thu, 14 Mar 2024 16:32:36 -0400 Subject: [PATCH] test: fix permissions for note tests --- program/tests/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/program/tests/__init__.py b/program/tests/__init__.py index 5df9849a..a6dc4fb1 100644 --- a/program/tests/__init__.py +++ b/program/tests/__init__.py @@ -1,6 +1,6 @@ import datetime -from django.contrib.auth.models import User +from django.contrib.auth.models import Permission, User from django.utils.text import slugify from django.utils.timezone import now from program.models import Note, RRule, Schedule, Show, TimeSlot @@ -31,6 +31,8 @@ class UserMixin: self.user_common = User.objects.create_user( "herbert", "herbert@aura.radio", password="herbert" ) + note_permissions = Permission.objects.filter(content_type__model="note") + self.user_common.user_permissions.add(*note_permissions) class ShowMixin: @@ -78,14 +80,12 @@ class NoteMixin: _title = kwargs.get("title", f"a random note #{note_count}") kwargs["timeslot"] = timeslot kwargs["title"] = _title - kwargs.setdefault("slug", slugify(_title)) return Note.objects.create(**kwargs) def _create_random_note_content(self, **kwargs): note_count = Note.objects.all().count() _title = kwargs.get("title", f"a random note #{note_count}") kwargs["title"] = _title - kwargs.setdefault("slug", slugify(_title)) kwargs.setdefault("content", "some random content") kwargs.setdefault("contributor_ids", []) return kwargs -- GitLab