1 # ============LICENSE_START=======================================================
3 # ================================================================================
4 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
19 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 # -*- coding: utf-8 -*-
23 Provides tests for the docker_util module
26 from dcae_cli.util.profiles import Profile, CONSUL_HOST, CONFIG_BINDING_SERVICE, CDAP_BROKER, DOCKER_HOST
27 from dcae_cli.util import docker_util as du
30 # TODO: formalize tests
32 from dcae_cli.util.logger import set_verbose
35 client = _get_docker_client()
38 interface_map = dict()
40 # TODO: make-me-valid?
41 external_ip ='196.207.143.209'
43 # TODO: Need to replace the use of asimov
44 _run_component('asimov-anomaly-viz:0.0.0',
45 'bob', 'asimov.anomaly.viz', '1.0.0', params, interface_map, instance_map,
49 def test_convert_profile_to_docker_envs():
50 expected = { CONSUL_HOST.upper(): "some.consul.somewhere",
51 CONFIG_BINDING_SERVICE.upper(): "some.config_binding.somewhere",
52 CDAP_BROKER.upper(): "broker",
53 DOCKER_HOST.upper(): "some-docker-host"
55 profile = Profile(**{ CONSUL_HOST: expected[CONSUL_HOST.upper()],
56 CONFIG_BINDING_SERVICE: expected[CONFIG_BINDING_SERVICE.upper()],
57 CDAP_BROKER: expected[CDAP_BROKER.upper()],
58 DOCKER_HOST: expected[DOCKER_HOST.upper()]
60 actual = du._convert_profile_to_docker_envs(profile)
62 assert actual == expected