1 # ============LICENSE_START=======================================================
3 # ================================================================================
4 # Copyright (c) 2018 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 This module is actually for pytesting. This contains fixtures.
27 # REVIEW: Having issues trying to share this amongst all the tests. Putting this
28 # fixture here allows it to be shared when running tests over the entire project.
29 # The pytest recommendation was to place this file high up in the project.
32 def mock_cli_config(monkeypatch):
33 """Fixture to provide a mock dcae-cli configuration and profiles
35 This fixture monkeypatches the respective get calls to return mock objects
37 fake_config = { "active_profile": "default", "user": "bob",
38 "server_url": "https://git.onap.org/dcaegen2/platform/cli/plain",
39 "db_url": "postgresql://postgres:abc123@localhost:5432/dcae_onboarding_db"
42 fake_profiles = { "default": { "consul_host": "consul",
43 "cdap_broker": "cdap_broker",
44 "config_binding_service": "config_binding_service",
45 "docker_host": "docker_host" }
47 fake_profiles["active"] = fake_profiles["default"]
49 def fake_get_config():
52 def fake_get_profiles(user_only=False, include_active=True):
55 from dcae_cli.util import config, profiles
56 monkeypatch.setattr(dcae_cli.util.config, "get_config", fake_get_config)
57 monkeypatch.setattr(dcae_cli.util.profiles, "get_profiles", fake_get_profiles)