--- /dev/null
+# .coveragerc to control coverage.py
+[run]
+branch = True
+
+[report]
+# Regexes for lines to exclude from consideration
+exclude_lines =
+ # Have to re-enable the standard pragma
+ pragma: no cover
+
+ # Don't complain about missing debug-only code:
+ def __repr__
+ if self\.debug
+
+ # Don't complain if tests don't hit defensive assertion code:
+ raise AssertionError
+ raise NotImplementedError
+
+ # Don't complain if non-runnable code isn't run:
+ if 0:
+ if __name__ == .__main__.:
monkeypatch.setattr("dcae_cli._version.__version__", "2.X.X")
expected = {'cli_version': '2.X.X', 'user': 'bigmama', 'db_url': 'conn',
- 'server_url': 'http://some-nexus-in-the-sky.com'}
+ 'server_url': 'http://some-nexus-in-the-sky.com',
+ 'active_profile': 'default' }
assert expected == config._init_config()
# Test using of db fallback
monkeypatch.setattr(dcae_cli.util, 'fetch_file_from_web',
lambda server_url, path: { "db_url": "" })
- assert "sqlite" in config._init_config()["db_url"]
+ db_url = "postgresql://king:of@mountain:5432/dcae_onboarding_db"
+
+ def fake_init_config_db_url():
+ return db_url
+
+ monkeypatch.setattr(config, "_init_config_db_url",
+ fake_init_config_db_url)
+
+ assert db_url == config._init_config()["db_url"]
monkeypatch.setattr(dcae_cli.util, 'fetch_file_from_web',
lambda server_url, path: {})
- assert "sqlite" in config._init_config()["db_url"]
+ assert db_url == config._init_config()["db_url"]
# Simulate error trying to fetch
monkeypatch.setattr(dcae_cli.util, 'fetch_file_from_web',
fetch_simulate_error)
+ # Case when user opts out of manually setting up
+ monkeypatch.setattr(click, "confirm", lambda msg: False)
with pytest.raises(config.ConfigurationInitError):
config._init_config()
raise RuntimeError("Mysterious error")
monkeypatch.setattr(util, "fetch_file_from_web", fetch_failure)
+ # Case when user opts out of manually setting up
+ monkeypatch.setattr(click, "confirm", lambda msg: False)
with pytest.raises(profiles.ProfilesInitError):
profiles.reinit_profiles()
# TODO: May need to add the following line
-# --extra-index-url <onap pypi url>
python-consul==0.6.1
six==1.10.0
SQLAlchemy==1.1.4
jsonschema==2.5.1
docker-py==1.10.6
terminaltables==3.1.0
-python-discovery-client==2.0.0
-python-dockering==1.2.1
+onap-dcae-discovery-client==2.1.0
+onap-dcae-dockering==1.3.0
psycopg2==2.7.1
genson==0.2.2
setup(
- name = "dcae_cli",
+ name = "onap-dcae-cli",
version = __version__,
packages = find_packages(),
author = "Michael Hwang, Paul Triantafyllou, Tommy Carpenter",
'SQLAlchemy-Utils',
'click',
'jsonschema',
- 'docker-py>=1.10,<2',
'terminaltables',
'psycopg2',
'genson',
- 'python-discovery-client>=2.0.0',
- 'python-dockering>=1.0.0,<2.0.0'
+ 'onap-dcae-discovery-client>=2.0.0',
+ 'onap-dcae-dockering>=1.0.0,<2.0.0'
],
tests_require=['pytest',
'mock'],
--- /dev/null
+# content of: tox.ini , put in same dir as setup.py
+[tox]
+envlist = py27,py35
+
+[testenv]
+deps=
+ pytest
+ coverage
+ pytest-cov
+ mock
+commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/dcae_cli --cov-report=xml