Esempio n. 1
0
def test_verify_required_attributes_missing_user(monkeypatch):
    if os.getenv('DEPLOYMENT_USER'):
        monkeypatch.delenv('DEPLOYMENT_USER')

    with patch('flow.utils.commons.print_msg') as mock_printmsg_fn:
        with pytest.raises(SystemExit):
            _cf = CloudFoundry()
            _cf._verify_required_attributes()

    mock_printmsg_fn.assert_called_with('CloudFoundry', '_verify_required_attributes', "No User Id. Did you forget to define environment variable 'DEPLOYMENT_USER?", 'ERROR')
Esempio n. 2
0
def test_verify_required_attributes_missing_org(monkeypatch):
    monkeypatch.setenv('DEPLOYMENT_USER', 'DUMMY')
    monkeypatch.setenv('DEPLOYMENT_PWD', 'DUMMY')

    with patch('flow.utils.commons.print_msg') as mock_printmsg_fn:
        with pytest.raises(SystemExit):
            _b = MagicMock(BuildConfig)
            _b.build_env_info = mock_build_config_missing_org_dict['environments']['unittest']
            _b.json_config = mock_build_config_missing_org_dict
            _b.version_number = None

            _cf = CloudFoundry(_b)
            _cf._verify_required_attributes()

    mock_printmsg_fn.assert_called_with('CloudFoundry', '_verify_required_attributes', "The build config associated with cloudfoundry is missing key 'org'", 'ERROR')