Exemplo n.º 1
0
def mock_os(osclient, mock_keystone_data):
    with mock.patch.object(osclient, "glanceclient"):
        with mock.patch.object(osclient, "novaclient"):
            with mock.patch.object(osclient, "session"):
                with mock.patch.object(osclient, "identity"):
                    with mock.patch.object(osclient.OSClient,
                                           "_ask_for_version",
                                           return_value='v2'):
                        o = osclient.OSClient(mock_keystone_data, {}, {}, {})
                        o.glance = mock.MagicMock()
                        o.nova = mock.MagicMock()
    return o
Exemplo n.º 2
0
def test_init_disable_warnings(osclient, actual_keystone_data_v2):
    with mock.patch.object(osclient, 'novaclient'):
        with mock.patch.object(osclient, 'glanceclient'):
            assert osclient.OSClient(actual_keystone_data_v2, {}, {}, {}, {},
                                     disable_warnings=True)
Exemplo n.º 3
0
def test_init(osclient, actual_keystone_data_v2):
    with mock.patch.object(osclient, 'novaclient'):
        with mock.patch.object(osclient, 'glanceclient'):
            assert osclient.OSClient(actual_keystone_data_v2, {}, {}, {}, {})
Exemplo n.º 4
0
def empty_OSClient(osclient):
    with mock.patch.object(osclient.OSClient, "__init__", return_value=None):
        eos = osclient.OSClient()
    return eos