Merge "Some tests are ignored"
This commit is contained in:
commit
7c72d6f912
@ -19,6 +19,7 @@
|
||||
|
||||
from ceilometerclient import client
|
||||
from ceilometerclient.exc import HTTPUnauthorized
|
||||
|
||||
from watcher.common import keystone
|
||||
|
||||
|
||||
|
@ -19,10 +19,11 @@ from __future__ import unicode_literals
|
||||
|
||||
from mock import MagicMock
|
||||
from mock import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from watcher.common.ceilometer import CeilometerClient
|
||||
|
||||
from watcher.tests.base import BaseTestCase
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class TestCeilometer(BaseTestCase):
|
||||
@ -44,8 +45,12 @@ class TestCeilometer(BaseTestCase):
|
||||
resource_ids=["resource_ids"])
|
||||
self.assertEqual(query, expected)
|
||||
|
||||
@mock.patch("watcher.common.keystone.Keystoneclient")
|
||||
def test_get_ceilometer_v2(self, mock_keystone):
|
||||
@mock.patch('keystoneclient.v2_0.client.Client', autospec=True)
|
||||
@mock.patch('ceilometerclient.v2.client.Client', autospec=True)
|
||||
def test_get_ceilometer_v2(self, mock_keystone, mock_ceilometer):
|
||||
cfg.CONF.set_override(
|
||||
'auth_uri', "http://127.0.0.1:9898/v2", group="keystone_authtoken"
|
||||
)
|
||||
c = CeilometerClient(api_version='2')
|
||||
from ceilometerclient.v2 import Client
|
||||
self.assertIsInstance(c.cmclient, Client)
|
||||
@ -77,8 +82,8 @@ class TestCeilometer(BaseTestCase):
|
||||
|
||||
@mock.patch.object(CeilometerClient, "cmclient")
|
||||
def test_get_last_sample_none(self, mock_keystone):
|
||||
expected = False
|
||||
mock_keystone.samples.list.return_value = None
|
||||
expected = []
|
||||
mock_keystone.samples.list.return_value = expected
|
||||
val = self.cm.get_last_sample_values(
|
||||
resource_id="id",
|
||||
meter_name="compute.node.percent"
|
@ -17,23 +17,26 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
from keystoneclient.auth.identity import Password
|
||||
|
||||
from keystoneclient.session import Session
|
||||
from mock import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from watcher.common.keystone import KeystoneClient
|
||||
|
||||
from watcher.tests.base import BaseTestCase
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
class TestKeyStone(BaseTestCase):
|
||||
|
||||
class TestKeystone(BaseTestCase):
|
||||
def setUp(self):
|
||||
super(TestKeyStone, self).setUp()
|
||||
super(TestKeystone, self).setUp()
|
||||
self.ckeystone = KeystoneClient()
|
||||
|
||||
@mock.patch('keystoneclient.client.Client')
|
||||
def test_get_endpoint(self, keystone):
|
||||
expected_endpoint = "http://IP:PORT"
|
||||
@mock.patch('keystoneclient.v2_0.client.Client', autospec=True)
|
||||
def test_get_endpoint_v2(self, keystone):
|
||||
expected_endpoint = "http://ip:port/v2"
|
||||
cfg.CONF.set_override(
|
||||
'auth_uri', expected_endpoint, group="keystone_authtoken"
|
||||
)
|
||||
ks = mock.Mock()
|
||||
ks.service_catalog.url_for.return_value = expected_endpoint
|
||||
keystone.return_value = ks
|
Loading…
Reference in New Issue
Block a user