Merge "Don't trigger danube branch"
[releng.git] / utils / test / testapi / opnfv_testapi / tests / unit / common / test_config.py
1 import argparse
2 import pytest
3
4
5 def test_config_normal(mocker, config_normal):
6     mocker.patch(
7         'argparse.ArgumentParser.parse_known_args',
8         return_value=(argparse.Namespace(config_file=config_normal), None))
9     from opnfv_testapi.common import config
10     CONF = config.Config()
11     assert CONF.mongo_url == 'mongodb://127.0.0.1:27017/'
12     assert CONF.mongo_dbname == 'test_results_collection'
13     assert CONF.api_port == 8000
14     assert CONF.api_debug is True
15     assert CONF.api_authenticate is False
16     assert CONF.ui_url == 'http://localhost:8000'
17
18
19 def test_config_file_not_exist(mocker):
20     mocker.patch('os.path.exists', return_value=False)
21     with pytest.raises(Exception) as m_exc:
22         from opnfv_testapi.common import config
23         config.Config()
24     assert 'not found' in str(m_exc.value)