Skip to content
Snippets Groups Projects
test_public_controller.py 1.89 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Trattnig's avatar
    David Trattnig committed
    #
    # Aura Engine API (https://gitlab.servus.at/aura/engine-api)
    #
    # Copyright (C) 2020 - The Aura Engine Team.
    #
    # This program is free software: you can redistribute it and/or modify
    # it under the terms of the GNU Affero General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU Affero General Public License for more details.
    #
    # You should have received a copy of the GNU Affero General Public License
    # along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    
    David Trattnig's avatar
    David Trattnig committed
    
    from __future__ import absolute_import
    
    
    Chris Pastl's avatar
    Chris Pastl committed
    # from aura_engine_api.rest.models.track import Track  # noqa: E501
    from . import BaseTestCase
    
    David Trattnig's avatar
    David Trattnig committed
    
    
    Chris Pastl's avatar
    Chris Pastl committed
    # from flask import json
    # from six import BytesIO
    
    David Trattnig's avatar
    David Trattnig committed
    
    
    class TestPublicController(BaseTestCase):
        """PublicController integration test stubs"""
    
        def test_current_track(self):
            """Test case for current_track
    
            Get current track
            """
    
    Chris Pastl's avatar
    Chris Pastl committed
            response = self.client.open("/api/v1/trackservice/current", method="GET")
            self.assert200(response, "Response body is : " + response.data.decode("utf-8"))
    
    David Trattnig's avatar
    David Trattnig committed
    
        def test_list_tracks(self):
            """Test case for list_tracks
    
            List recent tracks in the play-log
            """
    
    Chris Pastl's avatar
    Chris Pastl committed
            query_string = [
                ("from_date", "2013-10-20T19:20:30+01:00"),
                ("to_date", "2013-10-20T19:20:30+01:00"),
                ("page", 56),
                ("limit", 50),
            ]
    
    David Trattnig's avatar
    David Trattnig committed
            response = self.client.open(
    
    Chris Pastl's avatar
    Chris Pastl committed
                "/api/v1/trackservice", method="GET", query_string=query_string
            )
            self.assert200(response, "Response body is : " + response.data.decode("utf-8"))
    
    Chris Pastl's avatar
    Chris Pastl committed
    if __name__ == "__main__":
    
    David Trattnig's avatar
    David Trattnig committed
        import unittest
    
    Chris Pastl's avatar
    Chris Pastl committed
    
    
    David Trattnig's avatar
    David Trattnig committed
        unittest.main()