コード例 #1
0
    def _addNetworkWithExc(self, netName, opts, errCode):
        fakeInfo = netinfo.cache.CachingNetInfo(FAKE_NETINFO)
        configurator = ifcfg.Ifcfg(fakeInfo)

        with self.assertRaises(errors.ConfigNetworkError) as cneContext:
            canonicalize_networks({netName: opts})
            legacy_switch._add_network(netName, configurator, fakeInfo, **opts)
        self.assertEqual(cneContext.exception.errCode, errCode)
コード例 #2
0
    def _addNetworkWithExc(self, netName, opts, errCode):
        fakeInfo = netinfo.cache.CachingNetInfo(FAKE_NETINFO)
        configurator = ifcfg.Ifcfg(fakeInfo)

        with pytest.raises(errors.ConfigNetworkError) as cneContext:
            canonicalize_networks({netName: opts})
            validator.validate_network_setup({netName: opts}, {}, FAKE_NETINFO)
            legacy_switch._add_network(netName, configurator, fakeInfo, None,
                                       **opts)
        assert cneContext.value.errCode == errCode