diff options
author | Emma Foley <emma.l.foley@intel.com> | 2018-01-25 23:10:31 +0000 |
---|---|---|
committer | Emma Foley <emma.l.foley@intel.com> | 2018-03-02 11:54:15 +0000 |
commit | 97cb29356bee55639cb3e3343aae50abec2d329e (patch) | |
tree | de612ec84d22ce8c4089831138dfd5e5b0805c8e /tests/unit/network_services/nfvi | |
parent | 23c32c26ccba99c5307c865dfb7673cf5e6e1acc (diff) |
Replace assertEqual(None, xx) with assertIsNone(xx)
Change-Id: Ie956d8064a8fbcbd3d56c5a79c4c613d35184af4
JIRA: YARDSTICK-942
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
Diffstat (limited to 'tests/unit/network_services/nfvi')
-rw-r--r-- | tests/unit/network_services/nfvi/test_collectd.py | 54 | ||||
-rw-r--r-- | tests/unit/network_services/nfvi/test_resource.py | 2 |
2 files changed, 25 insertions, 31 deletions
diff --git a/tests/unit/network_services/nfvi/test_collectd.py b/tests/unit/network_services/nfvi/test_collectd.py index 866c31d32..0ae175624 100644 --- a/tests/unit/network_services/nfvi/test_collectd.py +++ b/tests/unit/network_services/nfvi/test_collectd.py @@ -34,7 +34,7 @@ class TestAmqpConsumer(unittest.TestCase): self.amqp_consumer._connection.add_on_close_callback = \ mock.Mock(return_value=0) self.amqp_consumer._connection.channel = mock.Mock(return_value=0) - self.assertEqual(None, self.amqp_consumer.on_connection_open(10)) + self.assertIsNone(self.amqp_consumer.on_connection_open(10)) def test_on_connection_closed(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) @@ -42,13 +42,11 @@ class TestAmqpConsumer(unittest.TestCase): self.amqp_consumer._connection.ioloop.stop = mock.Mock(return_value=0) self.amqp_consumer._connection.add_timeout = mock.Mock(return_value=0) self.amqp_consumer._closing = True - self.assertEqual(None, - self.amqp_consumer.on_connection_closed("", 404, - "Not Found")) + self.assertIsNone( + self.amqp_consumer.on_connection_closed("", 404, "Not Found")) self.amqp_consumer._closing = False - self.assertEqual(None, - self.amqp_consumer.on_connection_closed("", 404, - "Not Found")) + self.assertIsNone( + self.amqp_consumer.on_connection_closed("", 404, "Not Found")) def test_reconnect(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) @@ -56,7 +54,7 @@ class TestAmqpConsumer(unittest.TestCase): self.amqp_consumer._connection.ioloop.stop = mock.Mock(return_value=0) self.amqp_consumer.connect = mock.Mock(return_value=0) self.amqp_consumer._closing = True - self.assertEqual(None, self.amqp_consumer.reconnect()) + self.assertIsNone(self.amqp_consumer.reconnect()) def test_on_channel_open(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) @@ -66,9 +64,8 @@ class TestAmqpConsumer(unittest.TestCase): self.amqp_consumer.add_on_channel_close_callback = mock.Mock() self.amqp_consumer._channel.exchange_declare = \ mock.Mock(return_value=0) - self.assertEqual(None, - self.amqp_consumer.on_channel_open( - self.amqp_consumer._channel)) + self.assertIsNone( + self.amqp_consumer.on_channel_open(self.amqp_consumer._channel)) def test_add_on_channel_close_callback(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) @@ -76,46 +73,44 @@ class TestAmqpConsumer(unittest.TestCase): mock.Mock(return_value=0) self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.add_on_close_callback = mock.Mock() - self.assertEqual(None, - self.amqp_consumer.add_on_channel_close_callback()) + self.assertIsNone(self.amqp_consumer.add_on_channel_close_callback()) def test_on_channel_closed(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) self.amqp_consumer._connection.close = mock.Mock(return_value=0) _channel = mock.Mock() - self.assertEqual(None, - self.amqp_consumer.on_channel_closed(_channel, - "", "")) + self.assertIsNone( + self.amqp_consumer.on_channel_closed(_channel, "", "")) def test_ion_exchange_declareok(self): self.amqp_consumer.setup_queue = mock.Mock(return_value=0) - self.assertEqual(None, self.amqp_consumer.on_exchange_declareok(10)) + self.assertIsNone(self.amqp_consumer.on_exchange_declareok(10)) def test_setup_queue(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.add_on_close_callback = mock.Mock() - self.assertEqual(None, self.amqp_consumer.setup_queue("collectd")) + self.assertIsNone(self.amqp_consumer.setup_queue("collectd")) def test_on_queue_declareok(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.queue_bind = mock.Mock() - self.assertEqual(None, self.amqp_consumer.on_queue_declareok(10)) + self.assertIsNone(self.amqp_consumer.on_queue_declareok(10)) def test__on_bindok(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.basic_consume = mock.Mock() self.amqp_consumer.add_on_cancel_callback = mock.Mock() - self.assertEqual(None, self.amqp_consumer._on_bindok(10)) + self.assertIsNone(self.amqp_consumer._on_bindok(10)) def test_add_on_cancel_callback(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.add_on_cancel_callback = mock.Mock() - self.assertEqual(None, self.amqp_consumer.add_on_cancel_callback()) + self.assertIsNone(self.amqp_consumer.add_on_cancel_callback()) def test_on_consumer_cancelled(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.close = mock.Mock() - self.assertEqual(None, self.amqp_consumer.on_consumer_cancelled(10)) + self.assertIsNone(self.amqp_consumer.on_consumer_cancelled(10)) def test_on_message(self): body = "msg {} cpu/cpu-0/ipc 101010:10" @@ -123,25 +118,24 @@ class TestAmqpConsumer(unittest.TestCase): basic_deliver = mock.Mock() basic_deliver.delivery_tag = mock.Mock(return_value=0) self.amqp_consumer.ack_message = mock.Mock() - self.assertEqual(None, - self.amqp_consumer.on_message(10, basic_deliver, - properties, body)) + self.assertIsNone( + self.amqp_consumer.on_message(10, basic_deliver, properties, body)) def test_ack_message(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.basic_ack = mock.Mock() - self.assertEqual(None, self.amqp_consumer.ack_message(10)) + self.assertIsNone(self.amqp_consumer.ack_message(10)) def test_on_cancelok(self): self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.close = mock.Mock() - self.assertEqual(None, self.amqp_consumer.on_cancelok(10)) + self.assertIsNone(self.amqp_consumer.on_cancelok(10)) def test_run(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) self.amqp_consumer.connect = mock.Mock() self.amqp_consumer._connection.ioloop.start = mock.Mock() - self.assertEqual(None, self.amqp_consumer.run()) + self.assertIsNone(self.amqp_consumer.run()) def test_stop(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) @@ -149,9 +143,9 @@ class TestAmqpConsumer(unittest.TestCase): self.amqp_consumer._connection.ioloop.start = mock.Mock() self.amqp_consumer._channel = mock.Mock() self.amqp_consumer._channel.basic_cancel = mock.Mock() - self.assertEqual(None, self.amqp_consumer.stop()) + self.assertIsNone(self.amqp_consumer.stop()) def test_close_connection(self): self.amqp_consumer._connection = mock.Mock(autospec=AmqpConsumer) self.amqp_consumer._connection.close = mock.Mock() - self.assertEqual(None, self.amqp_consumer.close_connection()) + self.assertIsNone(self.amqp_consumer.close_connection()) diff --git a/tests/unit/network_services/nfvi/test_resource.py b/tests/unit/network_services/nfvi/test_resource.py index 7ad166249..d5280eabb 100644 --- a/tests/unit/network_services/nfvi/test_resource.py +++ b/tests/unit/network_services/nfvi/test_resource.py @@ -245,7 +245,7 @@ class TestResourceProfile(unittest.TestCase): self.resource_profile.run_collectd_amqp = \ mock.Mock(return_value=0) res = self.resource_profile.amqp_process_for_nfvi_kpi() - self.assertEqual(None, res) + self.assertIsNone(res) def test_amqp_collect_nfvi_kpi(self): self.resource_profile.amqp_client = \ |