Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Service Desk
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
Mélanie Chauvel
funkwhale
Commits
fcf223ad
Commit
fcf223ad
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Broken 'Less listened' Radio in develop version"
parent
4ce59adc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/funkwhale_api/radios/radios.py
+1
-4
1 addition, 4 deletions
api/funkwhale_api/radios/radios.py
api/tests/radios/test_api.py
+15
-0
15 additions, 0 deletions
api/tests/radios/test_api.py
changes/changelog.d/912.bugfix
+1
-0
1 addition, 0 deletions
changes/changelog.d/912.bugfix
with
17 additions
and
4 deletions
api/funkwhale_api/radios/radios.py
+
1
−
4
View file @
fcf223ad
...
...
@@ -8,7 +8,6 @@ from rest_framework import serializers
from
funkwhale_api.moderation
import
filters
as
moderation_filters
from
funkwhale_api.music.models
import
Artist
,
Track
from
funkwhale_api.tags.models
import
Tag
from
funkwhale_api.users.models
import
User
from
.
import
filters
,
models
from
.registries
import
registry
...
...
@@ -263,9 +262,7 @@ class ArtistRadio(RelatedObjectRadio):
@registry.register
(
name
=
"
less-listened
"
)
class
LessListenedRadio
(
RelatedObjectRadio
):
model
=
User
class
LessListenedRadio
(
SessionRadio
):
def
clean
(
self
,
instance
):
instance
.
related_object
=
instance
.
user
super
().
clean
(
instance
)
...
...
This diff is collapsed.
Click to expand it.
api/tests/radios/test_api.py
+
15
−
0
View file @
fcf223ad
import
pytest
from
django.urls
import
reverse
from
funkwhale_api.music.serializers
import
TrackSerializer
...
...
@@ -129,3 +131,16 @@ def test_clean_config_is_called_on_serializer_save(mocker, factories):
instance
=
serializer
.
save
(
user
=
user
)
spied
.
assert_called_once_with
(
data
[
"
config
"
][
0
])
assert
instance
.
config
[
0
][
"
names
"
]
==
[
artist
.
name
]
@pytest.mark.parametrize
(
"
radio_type
"
,
[
"
random
"
,
"
less-listened
"
,
"
favorites
"
])
def
test_create_radio_session
(
radio_type
,
logged_in_api_client
):
url
=
reverse
(
"
api:v1:radios:sessions-list
"
)
response
=
logged_in_api_client
.
post
(
url
,
{
"
radio_type
"
:
radio_type
})
assert
response
.
status_code
==
201
assert
response
.
data
[
"
radio_type
"
]
==
radio_type
assert
(
response
.
data
[
"
id
"
]
==
logged_in_api_client
.
user
.
radio_sessions
.
latest
(
"
id
"
).
pk
)
This diff is collapsed.
Click to expand it.
changes/changelog.d/912.bugfix
0 → 100644
+
1
−
0
View file @
fcf223ad
Fixed broken less listened radio (#912)
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