def test_node_show(self, m_client): """ Test that correct client methods are called with node_show. """ host_dict = { "host1": { "as_num": "22", "ip_addr_v4": "1.2.3.4", "ip_addr_v6": "a:b:c::d", "peer_v4": [{ "ip": "1.1.1.1", "as_num": "22" }, { "ip": "2.2.2.2", "as_num": "22" }], "peer_v6": [{ "ip": "a::b", "as_num": "22" }] } } m_client.get_hosts_data_dict.return_value = host_dict node.node_show() m_client.get_hosts_data_dict.assert_called_once_with() self.assertFalse(m_client.get_default_node_as.called)
def test_node_show_default_as(self, m_client): """ Test node_show gets default AS for host with no specific AS num. """ host_dict = { "host": {"as_num": "", "ip_addr_v4": "1.2.3.4", "ip_addr_v6": "a:b:c::d", "peer_v4": [], "peer_v6": []} } m_client.get_hosts_data_dict.return_value = host_dict node.node_show() m_client.get_hosts_data_dict.assert_called_once_with() m_client.get_default_node_as.assert_called_once_with()
def test_node_show(self, m_client): """ Test that correct client methods are called with node_show. """ host_dict = {"host1": {"as_num": "22", "ip_addr_v4": "1.2.3.4", "ip_addr_v6": "a:b:c::d", "peer_v4": [{"ip":"1.1.1.1", "as_num": "22"}, {"ip":"2.2.2.2", "as_num": "22"}], "peer_v6": [{"ip":"a::b", "as_num": "22"}]}} m_client.get_hosts_data_dict.return_value = host_dict node.node_show() m_client.get_hosts_data_dict.assert_called_once_with() self.assertFalse(m_client.get_default_node_as.called)
def test_node_show_default_as(self, m_client): """ Test node_show gets default AS for host with no specific AS num. """ host_dict = {"host":{"as_num": "", "ip_addr_v4": "1.2.3.4", "ip_addr_v6": "a:b:c::d", "peer_v4": [], "peer_v6": []}} m_client.get_hosts_data_dict.return_value = host_dict node.node_show() m_client.get_hosts_data_dict.assert_called_once_with() m_client.get_default_node_as.assert_called_once_with()