示例#1
0
    def test_de_json_all(self, client, track, artist_event, album_event):
        json_dict = {
            'id_': self.id,
            'type_': self.type,
            'type_for_from': self.type_for_from,
            'title': self.title,
            'tracks': [track.to_dict()],
            'artists': [artist_event.to_dict()],
            'albums': [album_event.to_dict()],
            'message': self.message,
            'device': self.device,
            'tracks_count': self.tracks_count,
            'genre': self.genre,
        }
        event = Event.de_json(json_dict, client)

        assert event.id == self.id
        assert event.type == self.type
        assert event.type_for_from == self.type_for_from
        assert event.title == self.title
        assert event.tracks == [track]
        assert event.artists == [artist_event]
        assert event.albums == [album_event]
        assert event.message == self.message
        assert event.device == self.device
        assert event.tracks_count == self.tracks_count
        assert event.genre == self.genre
示例#2
0
    def test_de_json_required(self, client):
        json_dict = {'id_': self.id, 'type_': self.type}
        event = Event.de_json(json_dict, client)

        assert event.id == self.id
        assert event.type == self.type
示例#3
0
 def test_de_json_none(self, client):
     assert Event.de_json({}, client) is None