"""
Unit tests for the app status view.

:copyright: Copyright 2013-2016, Dorian Pula <dorian.pula@amber-penguin-software.ca>
:license: AGPL v3+
"""

import http

import pytest

import rookeries
from tests import utils


@pytest.fixture
def flask_test_app():
    return rookeries.make_rookeries_app().test_client()


def test_app_status_view_returns_app_info_as_a_json(flask_test_app):
    expected_info = {
        'app': 'rookeries',
        'version': rookeries.__version__,
    }

    actual = flask_test_app.get('/status')

    assert actual.status_code == http.HTTPStatus.OK
    actual_json = utils.convert_response_into_json(actual)
    assert actual_json == expected_info
