Skip to content
Snippets Groups Projects
test_public_controller.py 2.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Trattnig's avatar
    David Trattnig committed
    # coding: utf-8
    
    from __future__ import absolute_import
    
    from flask import json
    from six import BytesIO
    
    
    from src.rest.models.play_log_entry import PlayLogEntry  # noqa: E501
    from src.rest.models.playlist import Playlist  # noqa: E501
    from src.rest.test import BaseTestCase
    
    David Trattnig's avatar
    David Trattnig committed
    
    
    class TestPublicController(BaseTestCase):
        """PublicController integration test stubs"""
    
    
        def test_current_playlist(self):
            """Test case for current_playlist
    
            Get current playlist
            """
            response = self.client.open(
    
                '/api/v1/playlist/current',
    
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
    
    David Trattnig's avatar
    David Trattnig committed
        def test_current_track(self):
            """Test case for current_track
    
            Get current track
            """
            response = self.client.open(
    
                '/api/v1/trackservice/current',
    
    David Trattnig's avatar
    David Trattnig committed
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
        def test_get_track(self):
            """Test case for get_track
    
            Get a single track by ID
            """
            response = self.client.open(
    
    David Trattnig's avatar
    David Trattnig committed
                '/api/v1/trackservice/{track_id}'.format(track_id=56),
    
    David Trattnig's avatar
    David Trattnig committed
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
        def test_list_tracks(self):
            """Test case for list_tracks
    
            List recent tracks in the play-log
            """
            query_string = [('offset', 56),
                            ('limit', 50)]
            response = self.client.open(
    
                '/api/v1/trackservice',
    
    David Trattnig's avatar
    David Trattnig committed
                method='GET',
                query_string=query_string)
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
    
        def test_next_playlist(self):
            """Test case for next_playlist
    
            Get next playlist
            """
            response = self.client.open(
    
    David Trattnig's avatar
    David Trattnig committed
                '/api/v1/playlist/next',
    
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
    
    David Trattnig's avatar
    David Trattnig committed
    
    if __name__ == '__main__':
        import unittest
        unittest.main()