aboutsummaryrefslogtreecommitdiffstats
path: root/app/test
diff options
context:
space:
mode:
Diffstat (limited to 'app/test')
-rw-r--r--app/test/fetch/cli_fetch/test_cli_fetch_host_pnics.py2
-rw-r--r--app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_ovs.py10
-rw-r--r--app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_vpp.py5
-rw-r--r--app/test/fetch/cli_fetch/test_cli_fetch_vconnectors.py66
-rw-r--r--app/test/fetch/cli_fetch/test_data/cli_fetch_vservice_vnics.py4
5 files changed, 12 insertions, 75 deletions
diff --git a/app/test/fetch/cli_fetch/test_cli_fetch_host_pnics.py b/app/test/fetch/cli_fetch/test_cli_fetch_host_pnics.py
index f5f327e..26885f3 100644
--- a/app/test/fetch/cli_fetch/test_cli_fetch_host_pnics.py
+++ b/app/test/fetch/cli_fetch/test_cli_fetch_host_pnics.py
@@ -118,7 +118,7 @@ class TestCliFetchHostPnics(TestFetch):
def test_handle_ipv6_address_line(self):
self.fetcher.handle_line(RAW_INTERFACE, IPV6_ADDRESS_LINE)
self.assertEqual(RAW_INTERFACE['IPv6 Address'], IPV6_ADDRESS,
- "Can' get the correct ipv6 address")
+ "Can't get the correct ipv6 address")
def test_handle_ipv4_address_line(self):
self.fetcher.handle_line(RAW_INTERFACE, IPV4_ADDRESS_LINE)
diff --git a/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_ovs.py b/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_ovs.py
index 24a1b5d..348d1b8 100644
--- a/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_ovs.py
+++ b/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_ovs.py
@@ -7,7 +7,8 @@
# which accompanies this distribution, and is available at #
# http://www.apache.org/licenses/LICENSE-2.0 #
###############################################################################
-from discover.cli_fetch_instance_vnics_ovs import CliFetchInstanceVnicsOvs
+from discover.fetchers.cli.cli_fetch_instance_vnics \
+ import CliFetchInstanceVnics
from test.fetch.test_fetch import TestFetch
from test.fetch.cli_fetch.test_data.cli_fetch_instance_vnics import *
from unittest.mock import MagicMock
@@ -17,7 +18,7 @@ class TestCliFetchInstanceVnicsOvs(TestFetch):
def setUp(self):
self.configure_environment()
- self.fetcher = CliFetchInstanceVnicsOvs()
+ self.fetcher = CliFetchInstanceVnics()
self.fetcher.set_env(self.env)
def test_set_vnic_properties(self):
@@ -29,8 +30,9 @@ class TestCliFetchInstanceVnicsOvs(TestFetch):
# reset method
self.fetcher.inv.set = original_set
- self.assertIn("source_bridge", VNIC, "Can't set source_bridge for ovs vnic")
+ self.assertIn("source_bridge", VNIC,
+ "Can't set source_bridge for ovs vnic")
def test_get_vnic_name(self):
name = self.fetcher.get_vnic_name(VNIC, INSATNCE)
- self.assertNotEqual(name, None, "Can't get vnic name") \ No newline at end of file
+ self.assertNotEqual(name, None, "Can't get vnic name")
diff --git a/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_vpp.py b/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_vpp.py
index 46c25fb..a54b881 100644
--- a/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_vpp.py
+++ b/app/test/fetch/cli_fetch/test_cli_fetch_instance_vnics_vpp.py
@@ -7,7 +7,8 @@
# which accompanies this distribution, and is available at #
# http://www.apache.org/licenses/LICENSE-2.0 #
###############################################################################
-from discover.cli_fetch_instance_vnics_vpp import CliFetchInstanceVnicsVpp
+from discover.fetchers.cli.cli_fetch_instance_vnics_vpp \
+ import CliFetchInstanceVnicsVpp
from test.fetch.cli_fetch.test_data.cli_fetch_instance_vnics import *
from test.fetch.test_fetch import TestFetch
@@ -20,4 +21,4 @@ class TestCliFetchInstanceVnicsVpp(TestFetch):
def test_get_name(self):
name = self.fetcher.get_vnic_name(VNIC, INSATNCE)
- self.assertNotEqual(name, None, "Can't get vnic name") \ No newline at end of file
+ self.assertNotEqual(name, None, "Can't get vnic name")
diff --git a/app/test/fetch/cli_fetch/test_cli_fetch_vconnectors.py b/app/test/fetch/cli_fetch/test_cli_fetch_vconnectors.py
deleted file mode 100644
index 23e0a99..0000000
--- a/app/test/fetch/cli_fetch/test_cli_fetch_vconnectors.py
+++ /dev/null
@@ -1,66 +0,0 @@
-###############################################################################
-# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) #
-# and others #
-# #
-# All rights reserved. This program and the accompanying materials #
-# are made available under the terms of the Apache License, Version 2.0 #
-# which accompanies this distribution, and is available at #
-# http://www.apache.org/licenses/LICENSE-2.0 #
-###############################################################################
-from discover.fetchers.cli.cli_fetch_vconnectors import CliFetchVconnectors
-from test.fetch.test_fetch import TestFetch
-from test.fetch.cli_fetch.test_data.cli_fetch_vconnectors import *
-from unittest.mock import MagicMock
-
-
-class TestCliFetchVconnectors(TestFetch):
-
- def setUp(self):
- self.configure_environment()
- self.fetcher = CliFetchVconnectors()
- self.fetcher.set_env(self.env)
-
- def test_get(self):
- # store original methods
- original_get_by_id = self.fetcher.inv.get_by_id
- original_get_vconnectors = self.fetcher.get_vconnectors
-
- # mock methods
- self.fetcher.inv.get_by_id = MagicMock(return_value=HOST)
- self.fetcher.get_vconnectors = MagicMock(return_value=VCONNECTORS)
-
- result = self.fetcher.get(VCONNECTORS_FOLDER['id'])
-
- # reset methods
- self.fetcher.inv.get_by_id = original_get_by_id
- self.fetcher.get_vconnectors = original_get_vconnectors
-
- self.assertEqual(result, VCONNECTORS, "Can't get the vconnectors")
-
- def test_get_without_host(self):
- # store original methods
- original_get_by_id = self.fetcher.inv.get_by_id
-
- # mock methods
- self.fetcher.inv.get_by_id = MagicMock(return_value=[])
-
- result = self.fetcher.get(VCONNECTORS_FOLDER['id'])
-
- # reset methods
- self.fetcher.inv.get_by_id = original_get_by_id
-
- self.assertEqual(result, [], "Can't get empty array when the host doesn't exist")
-
- def test_get_with_wrong_host(self):
- # store original methods
- original_get_by_id = self.fetcher.inv.get_by_id
-
- # mock methods
- self.fetcher.inv.get_by_id = MagicMock(return_value=WRONG_HOST)
-
- result = self.fetcher.get(VCONNECTORS_FOLDER['id'])
-
- # reset methods
- self.fetcher.inv.get_by_id = original_get_by_id
-
- self.assertEqual(result, [], "Can't get empty array when the host doesn't contain host type") \ No newline at end of file
diff --git a/app/test/fetch/cli_fetch/test_data/cli_fetch_vservice_vnics.py b/app/test/fetch/cli_fetch/test_data/cli_fetch_vservice_vnics.py
index 0b60af5..bef0ed2 100644
--- a/app/test/fetch/cli_fetch/test_data/cli_fetch_vservice_vnics.py
+++ b/app/test/fetch/cli_fetch/test_data/cli_fetch_vservice_vnics.py
@@ -198,7 +198,7 @@ RAW_VNIC = {
"vnic_type": "vservice_vnic"
}
-NETWORK = [{
+NETWORK = {
"admin_state_up": True,
"cidrs": [
"172.16.13.0/24"
@@ -252,7 +252,7 @@ NETWORK = [{
},
"tenant_id": "75c0eb79ff4a42b0ae4973c8375ddf40",
"type": "network"
-}]
+}
VSERVICE = {
"children_url": "/osdna_dev/discover.py?type=tree&id=qdhcp-8673c48a-f137-4497-b25d-08b7b218fd17",