Browse Source

updating unit tests

Change-Id: Ie6f868238064169ceb59efdc39a5637153c5a7f6
changes/03/695603/2
Dan Radez 3 months ago
parent
commit
f235ef6fb4
2 changed files with 13 additions and 3 deletions
  1. +4
    -1
      networking_ansible/tests/unit/ml2/test_mech_driver.py
  2. +9
    -2
      networking_ansible/tests/unit/test_ansible_networking.py

+ 4
- 1
networking_ansible/tests/unit/ml2/test_mech_driver.py View File

@@ -52,7 +52,10 @@ class TestBindPort(base.NetworkingAnsibleTestCase):
mock_prov_blks,
mock_vlan_access_port):
self.mech.bind_port(self.mock_port_context)
mock_vlan_access_port.assert_called_once()
mock_vlan_access_port.assert_called_once_with(
'assign',
self.mock_port_context.current,
self.mock_port_context.network.current)

def test_bind_port_mac_no_info_local_link_info(self,
mock_prov_blks,

+ 9
- 2
networking_ansible/tests/unit/test_ansible_networking.py View File

@@ -160,14 +160,21 @@ class TestConfTrunkPort(base.NetworkingAnsibleTestCase):
self.testsegid,
trunked_vlans=self.testsegids)

m_run_task.assert_called_once()
m_run_task.assert_called_once_with('conf_trunk_port',
self.testhost,
self.testsegid,
switch_port=self.testport,
trunked_vlans=self.testsegids)

def test_remove_trunk_port(self, m_run_task):
self.mech.ansnet.vlan_access_port('remove',
self.mock_port_context.current,
self.mock_net_context.current)

m_run_task.assert_called_once()
m_run_task.assert_called_once_with('delete_port',
self.testhost,
self.testsegid,
self.testport)

def test_remove_trunk_port_raises(self, m_run_task):
m_run_task.side_effect = exceptions.AnsibleRunnerException('test')

Loading…
Cancel
Save