コード例 #1
0
ファイル: test_Config.py プロジェクト: wxdublin/poseidon
def test_config_field_get_3T():
    '''
    Tests retrieving field from a section in the config file.
    '''
    resp = config_interface.get_endpoint('Handle_FieldConfig').direct_get(
        'double key', 'rest config test')
    assert resp == 'atlas horses'
コード例 #2
0
ファイル: test_Config.py プロジェクト: wxdublin/poseidon
def test_config_field_get_4F():
    '''
    Tests retrieving field from a section in the config file.
    '''
    resp = config_interface.get_endpoint('Handle_FieldConfig').direct_get(
        'not_a_key', 'bad_section')
    assert resp == 'Can\'t find field: not_a_key in section: bad_section'
コード例 #3
0
ファイル: test_Config.py プロジェクト: wxdublin/poseidon
def test_config_field_get_2():
    '''
    Tests retrieving field from a section in the config file.
    '''
    resp = config_interface.get_endpoint('Handle_FieldConfig').direct_get(
        'key2', 'rest config test')
    assert resp == 'theseus'
コード例 #4
0
ファイル: test_Config.py プロジェクト: wxdublin/poseidon
def test_config_full_get():
    h = hashlib.new('sha256')
    '''
    Tests retrieving the entire config file.
    '''
    resp = config_interface.get_endpoint('Handle_FullConfig').direct_get()
    h.update(resp.encode('utf-8'))
コード例 #5
0
def test_config_section_get_OK():
    '''
    Tests retrieving a section in the config file.
    '''
    resp = config_interface.get_endpoint(
        'Handle_SectionConfig').direct_get('rest config test')
    assert json.dumps(
        resp) == '[["key1", "trident"], ["key2", "theseus"], ["double key", "atlas horses"]]'
コード例 #6
0
ファイル: test_Config.py プロジェクト: wxdublin/poseidon
def test_config_section_get_FAIL():
    resp = config_interface.get_endpoint('Handle_SectionConfig').direct_get(
        'not_a_section')
    assert resp == 'Failed to find section: not_a_section'
コード例 #7
0
ファイル: test_Config.py プロジェクト: rubiruchi/poseidon-1
Created on 28 June 2016
@author: dgrossman, lanhamt
"""
import logging

import falcon
import pytest

from poseidon.poseidonMonitor.Config.Config import config_interface

module_logger = logging.getLogger(__name__)

application = falcon.API()
application.add_route('/v1/config',
                      config_interface.get_endpoint('Handle_FullConfig'))
application.add_route('/v1/config/{section}',
                      config_interface.get_endpoint('Handle_SectionConfig'))
application.add_route('/v1/config/{section}/{field}',
                      config_interface.get_endpoint('Handle_FieldConfig'))


# exposes the application for testing
@pytest.fixture
def app():
    return application


def test_config_full_get(client):
    """
    Tests retrieving the entire config file.