Fix basic_15 to disable password prompt error
[osm/osmclient.git] / osmclient / v1 / tests / test_ns.py
index 66361e8..616b8a4 100644 (file)
 import unittest
 from mock import Mock
 from osmclient.v1 import ns
+from osmclient.v1 import client
 from osmclient.common.exceptions import NotFound
 
 
 class TestNs(unittest.TestCase):
-
     def test_list_empty(self):
         mock = Mock()
         mock.get_cmd.return_value = list()
-        assert len(ns.Ns(mock).list()) == 0
+        assert len(ns.Ns(mock, client=client.Client(host="127.0.0.1")).list()) == 0
 
     def test_get_notfound(self):
         mock = Mock()
-        mock.get_cmd.return_value = 'foo'
-        self.assertRaises(NotFound, ns.Ns(mock).get, 'bar')
+        mock.get_cmd.return_value = "foo"
+        self.assertRaises(
+            NotFound, ns.Ns(mock, client=client.Client(host="127.0.0.1")).get, "bar"
+        )
 
     def test_get_found(self):
         mock = Mock()
-        mock.get_cmd.return_value = {'nsr:ns-instance-config':
-                                     {'nsr': [{'name': 'foo'}]}}
-        assert ns.Ns(mock).get('foo')
+        mock.get_cmd.return_value = {
+            "nsr:ns-instance-config": {"nsr": [{"name": "foo"}]}
+        }
+        assert ns.Ns(mock, client=client.Client(host="127.0.0.1")).get("foo")
 
     def test_get_monitoring_notfound(self):
         mock = Mock()
-        mock.get_cmd.return_value = 'foo'
-        self.assertRaises(NotFound, ns.Ns(mock).get_monitoring, 'bar')
+        mock.get_cmd.return_value = "foo"
+        self.assertRaises(
+            NotFound,
+            ns.Ns(mock, client=client.Client(host="127.0.0.1")).get_monitoring,
+            "bar",
+        )