summaryrefslogtreecommitdiffstats
path: root/tests/unit/network_services/nfvi
diff options
context:
space:
mode:
authorAbhijit Sinha <abhijit.sinha@intel.com>2018-03-02 15:39:36 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-02 15:39:36 +0000
commita74ad5a1ec1a73389c5983440b2031b0bc72cea1 (patch)
tree7c13c3b78cb8ae81219c7b9907f87dec7c499b3c /tests/unit/network_services/nfvi
parentc27266f509dd1fb07d7b03e5c6befe489a95a423 (diff)
parent97cb29356bee55639cb3e3343aae50abec2d329e (diff)
Merge "Replace assertEqual(None, xx) with assertIsNone(xx)"
Diffstat (limited to 'tests/unit/network_services/nfvi')
-rw-r--r--tests/unit/network_services/nfvi/test_collectd.py54
-rw-r--r--tests/unit/network_services/nfvi/test_resource.py2
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 = \