Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
steering
Commits
4f906b36
Verified
Commit
4f906b36
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: fix permissions for note tests
parent
ae721780
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/tests/__init__.py
+3
-3
3 additions, 3 deletions
program/tests/__init__.py
with
3 additions
and
3 deletions
program/tests/__init__.py
+
3
−
3
View file @
4f906b36
import
datetime
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.text
import
slugify
from
django.utils.timezone
import
now
from
django.utils.timezone
import
now
from
program.models
import
Note
,
RRule
,
Schedule
,
Show
,
TimeSlot
from
program.models
import
Note
,
RRule
,
Schedule
,
Show
,
TimeSlot
...
@@ -31,6 +31,8 @@ class UserMixin:
...
@@ -31,6 +31,8 @@ class UserMixin:
self
.
user_common
=
User
.
objects
.
create_user
(
self
.
user_common
=
User
.
objects
.
create_user
(
"
herbert
"
,
"
herbert@aura.radio
"
,
password
=
"
herbert
"
"
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
:
class
ShowMixin
:
...
@@ -78,14 +80,12 @@ class NoteMixin:
...
@@ -78,14 +80,12 @@ class NoteMixin:
_title
=
kwargs
.
get
(
"
title
"
,
f
"
a random note #
{
note_count
}
"
)
_title
=
kwargs
.
get
(
"
title
"
,
f
"
a random note #
{
note_count
}
"
)
kwargs
[
"
timeslot
"
]
=
timeslot
kwargs
[
"
timeslot
"
]
=
timeslot
kwargs
[
"
title
"
]
=
_title
kwargs
[
"
title
"
]
=
_title
kwargs
.
setdefault
(
"
slug
"
,
slugify
(
_title
))
return
Note
.
objects
.
create
(
**
kwargs
)
return
Note
.
objects
.
create
(
**
kwargs
)
def
_create_random_note_content
(
self
,
**
kwargs
):
def
_create_random_note_content
(
self
,
**
kwargs
):
note_count
=
Note
.
objects
.
all
().
count
()
note_count
=
Note
.
objects
.
all
().
count
()
_title
=
kwargs
.
get
(
"
title
"
,
f
"
a random note #
{
note_count
}
"
)
_title
=
kwargs
.
get
(
"
title
"
,
f
"
a random note #
{
note_count
}
"
)
kwargs
[
"
title
"
]
=
_title
kwargs
[
"
title
"
]
=
_title
kwargs
.
setdefault
(
"
slug
"
,
slugify
(
_title
))
kwargs
.
setdefault
(
"
content
"
,
"
some random content
"
)
kwargs
.
setdefault
(
"
content
"
,
"
some random content
"
)
kwargs
.
setdefault
(
"
contributor_ids
"
,
[])
kwargs
.
setdefault
(
"
contributor_ids
"
,
[])
return
kwargs
return
kwargs
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment