SoCo/SoCo

Test cases for the zoo of non-spec compliant events

Open

#545 ouverte le 23 nov. 2017

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)Python (234 forks)batch import
EnhancementHelp wanted

Métriques du dépôt

Stars
 (1 429 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Sonos doesn't seem to make too much of an effort in making sure that the events that pertain to music service elements are DIDL-Lite spec compliant. This means that in order to allow these event through the events.py code, we will need to relax our implementation of the spec. This is annoying, as it makes it more difficult to ensure large changes in the code base against regressions with these wild events.

In order to fix this, we should collect as many examples of events that broke the code as possible and make test cases out of them.

The procedure for collection as test is the following:

  1. Install version 0.12 (before too many of the bug fixes pertaining to wild events) of SoCo and check that you can make events code crash
  2. In events.py change the lines:
                    if value.startswith('<DIDL-Lite'):
                        value = from_didl_string(value)[0]

to

                    if value.startswith('<DIDL-Lite'):
                        try:
                            value = from_didl_string(value)[0]
                        except:
                            with open('broken_event.txt', 'wb') as file_:
                                file_.write(value.encode('utf-8'))
                            raise
  1. That should write a utf-8 encoded version of the event that caused the code to break, to a file called broken_event.txt in the current directory. Attach that file to this issue (see instructions for that here: https://help.github.com/articles/file-attachments-on-issues-and-pull-requests/) along with information about which music service and under which circumstances the code crashed and the traceback.

After we have collected the test cases, we should implement the functional tests for them. My ideas in that will follow. FIXME.

Guide contributeur