Ejemplo n.º 1
0
 def test_lsn_port_get_with_filters_return_none(self):
     self.mock_request.return_value = {
         "results": [{"uuid": "foo1"}, {"uuid": "foo2"}],
         "result_count": 2
     }
     result = lsnlib._lsn_port_get(self.cluster, "lsn_id", None)
     self.assertIsNone(result)
Ejemplo n.º 2
0
 def test_lsn_port_get_with_filters_return_none(self):
     self.mock_request.return_value = {
         "results": [{"uuid": "foo1"}, {"uuid": "foo2"}],
         "result_count": 2
     }
     result = lsnlib._lsn_port_get(self.cluster, "lsn_id", None)
     self.assertIsNone(result)
Ejemplo n.º 3
0
 def test_lsn_port_get_with_filters(self):
     lsn_id = "foo_lsn_id"
     port_id = "foo_port_id"
     filters = {"tag": "foo_tag", "tag_scope": "foo_scope"}
     self.mock_request.return_value = {
         "results": [{"uuid": port_id}],
         "result_count": 1
     }
     result = lsnlib._lsn_port_get(self.cluster, lsn_id, filters)
     self.assertEqual(result, port_id)
     self.mock_request.assert_called_once_with(
         "GET",
         ("/ws.v1/lservices-node/%s/lport?fields=uuid&tag_scope=%s&"
          "tag=%s" % (lsn_id, filters["tag_scope"], filters["tag"])),
         cluster=self.cluster)
Ejemplo n.º 4
0
 def test_lsn_port_get_with_filters(self):
     lsn_id = "foo_lsn_id"
     port_id = "foo_port_id"
     filters = {"tag": "foo_tag", "tag_scope": "foo_scope"}
     self.mock_request.return_value = {
         "results": [{"uuid": port_id}],
         "result_count": 1
     }
     result = lsnlib._lsn_port_get(self.cluster, lsn_id, filters)
     self.assertEqual(result, port_id)
     self.mock_request.assert_called_once_with(
         "GET",
         ("/ws.v1/lservices-node/%s/lport?fields=uuid&tag_scope=%s&"
          "tag=%s" % (lsn_id, filters["tag_scope"], filters["tag"])),
         cluster=self.cluster)