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
9496ad31
Verified
Commit
9496ad31
authored
4 months ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
test: add fixtures for user, api_client playlist perms, owned show, playlist & playlist_entry
parent
cb251108
No related branches found
No related tags found
1 merge request
!59
Add playlists
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
conftest.py
+42
-0
42 additions, 0 deletions
conftest.py
with
42 additions
and
0 deletions
conftest.py
+
42
−
0
View file @
9496ad31
...
...
@@ -15,6 +15,7 @@ from program.models import (
LinkType
,
MusicFocus
,
Playlist
,
PlaylistEntry
,
Profile
,
RadioSettings
,
RRule
,
...
...
@@ -35,6 +36,7 @@ from program.tests.factories import (
LinkTypeFactory
,
MusicFocusFactory
,
OwnerFactory
,
PlaylistEntryFactory
,
PlaylistFactory
,
ProfileFactory
,
RadioSettingsFactory
,
...
...
@@ -149,6 +151,17 @@ def user_with_note_perms() -> User:
return
UserWithPermissionsFactory
.
create
(
user_permissions
=
permissions
)
@pytest.fixture
def
user_with_playlist_perms
()
->
User
:
"""
User with add_playlist, change_playlist, delete_playlist permission
"""
permissions
=
Permission
.
objects
.
filter
(
codename__in
=
[
"
add_playlist
"
,
"
change_playlist
"
,
"
delete_playlist
"
]
)
return
UserWithPermissionsFactory
.
create
(
user_permissions
=
permissions
)
@pytest.fixture
def
common_api_client1
(
api_client
,
common_user1
)
->
APIClient
:
"""
Authenticated common user 1 API client
"""
...
...
@@ -176,6 +189,15 @@ def api_client_note_perms(api_client, user_with_note_perms) -> APIClient:
api_client
.
force_authenticate
()
@pytest.fixture
def
api_client_playlist_perms
(
api_client
,
user_with_playlist_perms
)
->
APIClient
:
"""
Authenticated API client for user with {add,change,delete}_playlist permissions
"""
api_client
.
force_authenticate
(
user_with_playlist_perms
)
yield
api_client
api_client
.
force_authenticate
()
@pytest.fixture
def
once_rrule
()
->
RRule
:
return
RRuleFactory
(
freq
=
0
)
...
...
@@ -221,6 +243,16 @@ def owned_show(common_user1, show) -> Show:
return
show
@pytest.fixture
def
owned_show_playlist_perms
(
user_with_playlist_perms
,
show
)
->
Show
:
"""
Show owned by user with playlist permissions
"""
show
.
owners
.
set
([
user_with_playlist_perms
])
show
.
save
()
return
show
@pytest.fixture
def
owned_show_once_timeslot
(
common_user1
,
show
,
once_schedule
)
->
TimeSlot
:
"""
Timeslot of a once schedule for a show owned by a common user
"""
...
...
@@ -308,3 +340,13 @@ def owner() -> User:
@pytest.fixture
def
default_playlist
(
show
)
->
Playlist
:
return
PlaylistFactory
(
description
=
"
default playlist
"
,
show
=
show
)
@pytest.fixture
def
playlist
(
show
)
->
Playlist
:
return
PlaylistFactory
(
show
=
show
)
@pytest.fixture
def
playlist_entry
(
playlist
)
->
PlaylistEntry
:
return
PlaylistEntryFactory
(
playlist
=
playlist
)
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