aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/python_moondb/tests/unit_python/mock_components.py
blob: a0319e1a41202448875cb9dd19e06a2f8a402c7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import utilities

COMPONENTS = (
    "logging",
    "openstack/keystone",
    "database",
    "slave",
    "components/manager",
    "components/orchestrator",
    "components/interface",
)


def register_components(m):
    for component in COMPONENTS:
        m.register_uri(
            'GET', 'http://consul:8500/v1/kv/{}'.format(component),
            json=[{'Key': component, 'Value': utilities.get_b64_conf(component)}]
        )

    m.register_uri(
        'GET', 'http://consul:8500/v1/kv/components?recurse=true',
        json=[
            {"Key": key, "Value": utilities.get_b64_conf(key)} for key in COMPONENTS
            ],
        # json={'Key': "components", 'Value': get_b64_conf("components")}
    )