summaryrefslogtreecommitdiff
path: root/nova/tests/unit/notifications
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2020-08-31 17:27:18 +0100
committerStephen Finucane <stephenfin@redhat.com>2020-11-24 15:29:21 +0000
commit9d1683f70f2c11c3c866ff457aa23a7a38421afe (patch)
tree91ee65567d96b06d13eb8bb1240a3b137eb13503 /nova/tests/unit/notifications
parent68bc87876f6479fe49b6a13a4c032eefe0ff016f (diff)
downloadnova-9d1683f70f2c11c3c866ff457aa23a7a38421afe.tar.gz
virt: Remove 'get_all_bw_counters' API
This one is a little more involved because there are persistent objects and versioned notifications to worry about, neither of which we can remove right now. Change-Id: Ic7c330ee1cccdc44a2a555c16cb6090eecbf6ce1 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Diffstat (limited to 'nova/tests/unit/notifications')
-rw-r--r--nova/tests/unit/notifications/test_base.py30
1 files changed, 3 insertions, 27 deletions
diff --git a/nova/tests/unit/notifications/test_base.py b/nova/tests/unit/notifications/test_base.py
index be941a8afe..3ee2e36ddc 100644
--- a/nova/tests/unit/notifications/test_base.py
+++ b/nova/tests/unit/notifications/test_base.py
@@ -63,14 +63,12 @@ class TestSendInstanceUpdateNotification(test.NoDBTestCase):
mock.sentinel.host,
mock.sentinel.service)
- @mock.patch.object(base, 'bandwidth_usage')
@mock.patch.object(base, '_compute_states_payload')
@mock.patch('nova.rpc.get_notifier')
@mock.patch.object(base, 'info_from_instance')
- def test_send_legacy_instance_update_notification(self, mock_info,
- mock_get_notifier,
- mock_states,
- mock_bw):
+ def test_send_legacy_instance_update_notification(
+ self, mock_info, mock_get_notifier, mock_states,
+ ):
"""Tests the case that versioned notifications are disabled and
assert that this does not prevent sending the unversioned
instance.update notification.
@@ -132,25 +130,3 @@ class TestSendInstanceUpdateNotification(test.NoDBTestCase):
populate_image_ref_url=False)
mock_gen_image_url.assert_not_called()
-
-
-class TestBandwidthUsage(test.NoDBTestCase):
- @mock.patch('nova.context.RequestContext.elevated')
- @mock.patch('nova.network.neutron.API')
- @mock.patch('nova.objects.BandwidthUsageList.get_by_uuids')
- def test_context_elevated(self, mock_get_bw_usage, mock_nw_api,
- mock_elevated):
- context = nova_context.RequestContext('fake', 'fake')
- # We need this to not be a NovaObject so the old school
- # get_instance_nw_info will run.
- instance = {'uuid': uuids.instance}
- audit_start = 'fake'
-
- base.bandwidth_usage(context, instance, audit_start)
-
- network_api = mock_nw_api.return_value
- network_api.get_instance_nw_info.assert_called_once_with(
- mock_elevated.return_value, instance)
- mock_get_bw_usage.assert_called_once_with(
- mock_elevated.return_value, [uuids.instance], audit_start)
- mock_elevated.assert_called_once_with(read_deleted='yes')