Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stub out 'tagtypes' subcommands #50

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions mopidy_mpd/protocol/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,21 @@ def notcommands(context):


@protocol.commands.add("tagtypes")
def tagtypes(context):
def tagtypes(context, *parameters):
"""
*musicpd.org, reflection section:*

``tagtypes``
``tagtypes [ALL | CLEAR | DISABLE {NAME...] | ENABLE {NAME...]]``

Shows a list of available song metadata.
"""
parameters = list(parameters)
if parameters:
subcommand = parameters.pop(0).lower()
if subcommand not in ("all", "clear", "disable", "enable"):
raise exceptions.MpdArgError("Unknown sub command")
# TODO: this is only a stub; we always return all tags anyhow.
return
return [("tagtype", tagtype) for tagtype in tagtype_list.TAGTYPE_LIST]


Expand Down
20 changes: 20 additions & 0 deletions tests/protocol/test_reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ def test_tagtypes(self):
self.assertInResponse("tagtype: MUSICBRAINZ_TRACKID")
self.assertInResponse("OK")

def test_tagtypes_clear(self):
self.send_request("tagtypes clear")
self.assertInResponse("OK")

def test_tagtypes_all(self):
self.send_request("tagtypes all")
self.assertInResponse("OK")

def test_tagtypes_disable(self):
self.send_request("tagtypes disable x")
self.assertInResponse("OK")

def test_tagtypes_enable(self):
self.send_request("tagtypes enable x")
self.assertInResponse("OK")

def test_tagtypes_bogus(self):
self.send_request("tagtypes bogus")
self.assertEqualResponse("ACK [2@0] {tagtypes} Unknown sub command")

def test_urlhandlers(self):
self.send_request("urlhandlers")
self.assertInResponse("OK")
Expand Down