shipyard/src/bin/shipyard_airflow/tests/unit/control/test_status_api.py
Smruti Soumitra Khuntia f4c724fbf1 A new Shipyard site statuses API and CLI
A new Shipyard site statuses API and CLI supporting nodes
provisoning status and node power state. This API
can be further developed to support new status
requirements by expanding the filters option.

Change-Id: I620aefd82d4a17b616f3f253265605e519506257
2018-07-31 09:16:36 +00:00

37 lines
1.4 KiB
Python

# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
""" Tests for the status_api"""
import json
from unittest.mock import patch
from shipyard_airflow.control.helpers.status_helper import \
StatusHelper
from shipyard_airflow.control.base import ShipyardRequestContext
from tests.unit.control import common
CTX = ShipyardRequestContext()
class TestStatusResource():
@patch.object(StatusHelper, 'get_site_statuses',
common.str_responder)
def test_on_get(self, api_client):
"""Validate the on_get method returns 200 on success"""
result = api_client.simulate_get(
"/api/v1.0/site_statuses", headers=common.AUTH_HEADERS)
assert result.status_code == 200
assert result.text == json.dumps(common.str_responder(), default=str)
assert result.headers[
'content-type'] == 'application/json; charset=UTF-8'