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
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)
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, {}, {}, {}, {})
def empty_OSClient(osclient): with mock.patch.object(osclient.OSClient, "__init__", return_value=None): eos = osclient.OSClient() return eos