Basically, if you decide to override a method, that is because you want to specify(or modify) the behavior of a method. If you just call the inherited method from the overridden method, that is unnecessary. Furthermore, every time when self.setUp() is called, now the super's setUp() is called, which is basically exact the same behavior as we have now. TrivialFix Change-Id: I9f4e03b93ff075c66b4e52342711c37f226d2f81
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
# Copyright 2017 Red Hat, Inc.
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import ddt
|
|
import mock
|
|
|
|
from manila import rpc
|
|
from manila import test
|
|
|
|
|
|
@ddt.ddt
|
|
class RPCTestCase(test.TestCase):
|
|
|
|
@ddt.data([], ['noop'], ['noop', 'noop'])
|
|
@mock.patch('oslo_messaging.JsonPayloadSerializer', wraps=True)
|
|
def test_init_no_notifications(self, driver, serializer_mock):
|
|
self.override_config('driver', driver,
|
|
group='oslo_messaging_notifications')
|
|
rpc.init(test.CONF)
|
|
self.assertEqual(rpc.utils.DO_NOTHING, rpc.NOTIFIER)
|
|
serializer_mock.assert_not_called()
|
|
|
|
@mock.patch.object(rpc, 'messaging')
|
|
def test_init_notifications(self, messaging_mock):
|
|
rpc.init(test.CONF)
|
|
self.assertTrue(messaging_mock.JsonPayloadSerializer.called)
|
|
self.assertTrue(messaging_mock.Notifier.called)
|
|
self.assertEqual(rpc.NOTIFIER, messaging_mock.Notifier.return_value)
|