mopidy/tests
Thomas Adamcik 455f3dd403 mpd: Write commands helper for tokenized command handling
This provides a class which works as a command registry. Functions are added to
the registry through a method on the class `add`.  Add acts as a decorator
taking in the name of the command and optionally type converters for arguments.

When handling requests, we can now tokenize the line, and then just pass the
arguments to our commands helper. It will lookup the correct handler and apply
any validation before calling the original function.

For the sake of testing the original function is not wrapped. This the
functions, and anything testing them directly can simply assume pre-converted
data as long as type annotations are in place.

A sample usage would be:

    @protocol.commands.add('addid', position=protocol.integer)
    def addid(context, uri, position=None)
        pass

    def handle_request(line):
        tokens = protocol.tokenizer(line)
        context = ...
        result = protocol.commands.call(tokens, context=context)
2014-01-19 19:59:07 +01:00
..
audio audio: Add tests for all fields that can be converted 2014-01-15 22:20:36 +01:00
backend Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
config Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
core dummy: Move dummy backend back into the mopidy package 2014-01-18 01:38:10 +01:00
data local: Make search filters more robust (fixes #635) 2014-01-17 23:43:43 +01:00
http Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
local local: Rename json test to new naming scheme 2014-01-18 01:35:33 +01:00
mpd mpd: Write commands helper for tokenized command handling 2014-01-19 19:59:07 +01:00
utils dummy: Move dummy backend back into the mopidy package 2014-01-18 01:38:10 +01:00
__init__.py tests: Use utf-8 when encoding our test data paths to bytes 2013-06-27 00:25:25 +02:00
__main__.py Remove unused yappi profiler 2012-12-15 23:46:52 +01:00
test_commands.py Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
test_exceptions.py Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
test_ext.py Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
test_help.py Rename test files to pattern expected by test runners 2014-01-15 00:01:50 +01:00
test_models.py model: Update to handle None in sets. 2014-01-15 22:20:36 +01:00
test_version.py Bump version to 0.18.0a1 for easier testing of updated extensions 2014-01-15 23:51:28 +01:00