Skip to content
Snippets Groups Projects
test_internal_controller.py 2.28 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.health_info import HealthInfo  # noqa: E501
    from src.rest.models.play_log_entry import PlayLogEntry  # noqa: E501
    from src.rest.models.status_entry import StatusEntry  # noqa: E501
    from src.rest.test import BaseTestCase
    
    David Trattnig's avatar
    David Trattnig committed
    
    
    class TestInternalController(BaseTestCase):
        """InternalController integration test stubs"""
    
    
        def test_activate_engine(self):
            """Test case for activate_engine
    
            Set active engine
            """
            response = self.client.open(
    
    David Trattnig's avatar
    David Trattnig committed
                '/api/v1/engine/{engine_number}/activate'.format(engine_number=2),
    
                method='PUT')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
    
    David Trattnig's avatar
    David Trattnig committed
        def test_get_active_engine(self):
            """Test case for get_active_engine
    
            Get active engine
            """
            response = self.client.open(
    
                '/api/v1/engine/current',
    
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
        def test_get_engine_health(self):
            """Test case for get_engine_health
    
            Get most recent health info
            """
            response = self.client.open(
    
    David Trattnig's avatar
    David Trattnig committed
                '/api/v1/engine/{engine_number}/health'.format(engine_number=2),
    
    David Trattnig's avatar
    David Trattnig committed
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
        def test_get_report(self):
            """Test case for get_report
    
            Report for one month
            """
            response = self.client.open(
    
                '/api/v1/report/{year_month}'.format(year_month='year_month_example'),
    
    David Trattnig's avatar
    David Trattnig committed
                method='GET')
            self.assert200(response,
                           'Response body is : ' + response.data.decode('utf-8'))
    
    
        def test_log_engine_health(self):
            """Test case for log_engine_health
    
            Log health info
            """
            response = self.client.open(
    
    David Trattnig's avatar
    David Trattnig committed
                '/api/v1/engine/{engine_number}/health'.format(engine_number=2),
    
                method='POST')
            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()