summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhijit Sinha <abhijit.sinha@intel.com>2018-05-02 16:46:29 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-05-02 16:46:29 +0000
commit153fd9e3bfe9682c6225e17e7e7fd3122569dd90 (patch)
tree75f055a3c895117219553d3e6ef6af622b484165
parentb05c13458ce6afef1171cd8463b7053e489d0497 (diff)
parent2e75e6d27240945ec985998bbe9ec6241d11626a (diff)
Merge "Move tests: unit/network_services/{lib/,collector/,*.py}"
-rw-r--r--yardstick/tests/unit/network_services/__init__.py (renamed from tests/unit/network_services/collector/__init__.py)0
-rw-r--r--yardstick/tests/unit/network_services/collector/__init__.py (renamed from tests/unit/network_services/libs/__init__.py)0
-rw-r--r--yardstick/tests/unit/network_services/collector/test_publisher.py (renamed from tests/unit/network_services/collector/test_publisher.py)3
-rw-r--r--yardstick/tests/unit/network_services/collector/test_subscriber.py (renamed from tests/unit/network_services/collector/test_subscriber.py)3
-rw-r--r--yardstick/tests/unit/network_services/libs/__init__.py (renamed from tests/unit/network_services/libs/ixia_libs/__init__.py)0
-rw-r--r--yardstick/tests/unit/network_services/libs/ixia_libs/__init__.py0
-rw-r--r--yardstick/tests/unit/network_services/libs/ixia_libs/test_IxNet.py (renamed from tests/unit/network_services/libs/ixia_libs/test_IxNet.py)14
-rw-r--r--yardstick/tests/unit/network_services/test_utils.py (renamed from tests/unit/network_services/test_utils.py)2
-rw-r--r--yardstick/tests/unit/network_services/test_yang_model.py (renamed from tests/unit/network_services/test_yang_model.py)12
9 files changed, 8 insertions, 26 deletions
diff --git a/tests/unit/network_services/collector/__init__.py b/yardstick/tests/unit/network_services/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/network_services/collector/__init__.py
+++ b/yardstick/tests/unit/network_services/__init__.py
diff --git a/tests/unit/network_services/libs/__init__.py b/yardstick/tests/unit/network_services/collector/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/network_services/libs/__init__.py
+++ b/yardstick/tests/unit/network_services/collector/__init__.py
diff --git a/tests/unit/network_services/collector/test_publisher.py b/yardstick/tests/unit/network_services/collector/test_publisher.py
index 4a175841d..145441ddd 100644
--- a/tests/unit/network_services/collector/test_publisher.py
+++ b/yardstick/tests/unit/network_services/collector/test_publisher.py
@@ -13,9 +13,6 @@
# limitations under the License.
#
-# Unittest for yardstick.network_services.collector.publisher
-
-from __future__ import absolute_import
import unittest
from yardstick.network_services.collector import publisher
diff --git a/tests/unit/network_services/collector/test_subscriber.py b/yardstick/tests/unit/network_services/collector/test_subscriber.py
index d4b4ecf7a..9b9649979 100644
--- a/tests/unit/network_services/collector/test_subscriber.py
+++ b/yardstick/tests/unit/network_services/collector/test_subscriber.py
@@ -13,9 +13,6 @@
# limitations under the License.
#
-# Unittest for yardstick.network_services.collector.subscriber
-
-from __future__ import absolute_import
import unittest
import mock
diff --git a/tests/unit/network_services/libs/ixia_libs/__init__.py b/yardstick/tests/unit/network_services/libs/__init__.py
index e69de29bb..e69de29bb 100644
--- a/tests/unit/network_services/libs/ixia_libs/__init__.py
+++ b/yardstick/tests/unit/network_services/libs/__init__.py
diff --git a/yardstick/tests/unit/network_services/libs/ixia_libs/__init__.py b/yardstick/tests/unit/network_services/libs/ixia_libs/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/yardstick/tests/unit/network_services/libs/ixia_libs/__init__.py
diff --git a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
index 2a97048aa..fe750e5ba 100644
--- a/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
+++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_IxNet.py
@@ -13,9 +13,6 @@
# limitations under the License.
#
-# Unittest for yardstick.network_services.libs.ixia_libs.IxNet
-
-from __future__ import absolute_import
import unittest
import mock
@@ -23,10 +20,10 @@ from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IxNextgen
from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IP_VERSION_4
from yardstick.network_services.libs.ixia_libs.IxNet.IxNet import IP_VERSION_6
-
UPLINK = "uplink"
DOWNLINK = "downlink"
+
class TestIxNextgen(unittest.TestCase):
def test___init__(self):
@@ -40,7 +37,8 @@ class TestIxNextgen(unittest.TestCase):
ixnet_gen.get_config = mock.MagicMock()
ixnet_gen.get_ixnet = mock.MagicMock()
- self.assertRaises(ImportError, ixnet_gen._connect, {"py_lib_path": "/tmp"})
+ self.assertRaises(ImportError, ixnet_gen._connect,
+ {"py_lib_path": "/tmp"})
def test_clear_ixia_config(self):
ixnet = mock.MagicMock()
@@ -628,11 +626,9 @@ class TestIxNextgen(unittest.TestCase):
def test_set_random_ip_multi_attributes_bad_ip_version(self):
bad_ip_version = object()
ixnet_gen = IxNextgen(mock.Mock())
- mock1 = mock.Mock()
- mock2 = mock.Mock()
- mock3 = mock.Mock()
with self.assertRaises(ValueError):
- ixnet_gen.set_random_ip_multi_attributes(mock1, bad_ip_version, mock2, mock3)
+ ixnet_gen.set_random_ip_multi_attributes(
+ mock.Mock(), bad_ip_version, mock.Mock(), mock.Mock())
def test_get_config(self):
tg_cfg = {
diff --git a/tests/unit/network_services/test_utils.py b/yardstick/tests/unit/network_services/test_utils.py
index bf98a4474..2b2eb7109 100644
--- a/tests/unit/network_services/test_utils.py
+++ b/yardstick/tests/unit/network_services/test_utils.py
@@ -13,8 +13,6 @@
# limitations under the License.
#
-# Unittest for yardstick.network_services.utils
-
import os
import unittest
import mock
diff --git a/tests/unit/network_services/test_yang_model.py b/yardstick/tests/unit/network_services/test_yang_model.py
index 0b29da701..a7eb36b8a 100644
--- a/tests/unit/network_services/test_yang_model.py
+++ b/yardstick/tests/unit/network_services/test_yang_model.py
@@ -13,14 +13,8 @@
# limitations under the License.
#
-# Unittest for yardstick.network_services.utils
-
-from __future__ import absolute_import
-
-import unittest
import mock
-
-import yaml
+import unittest
from yardstick.network_services.yang_model import YangModel
@@ -95,9 +89,9 @@ class YangModelTestCase(unittest.TestCase):
y._get_entries()
self.assertEqual(y._rules, '')
- @mock.patch('yardstick.network_services.yang_model.yaml_load')
@mock.patch('yardstick.network_services.yang_model.open')
- def test__read_config(self, mock_open, mock_safe_load):
+ @mock.patch('yardstick.network_services.yang_model.yaml_load')
+ def test__read_config(self, mock_safe_load, *args):
cfg = "yang.yaml"
y = YangModel(cfg)
mock_safe_load.return_value = expected = {'key1': 'value1', 'key2': 'value2'}