def test_mapped_nics_default(self): self._stub_active_nics(['em1', 'em2']) expected = {'nic1': 'em1', 'nic2': 'em2'} self.assertEqual(expected, objects._mapped_nics())
def test_mapped_nics_map_invalid_nic(self): self._stub_active_nics(['em1']) self._stub_available_nics(['em1', 'em2']) mapping = {'nic1': 'em1', 'nic2': 'foo'} expected = {'nic1': 'em1'} self.assertEqual(expected, objects._mapped_nics(nic_mapping=mapping))
def test_mapped_nics_mapped_partial_reordered(self): self._stub_active_nics(['em1', 'em2', 'em3', 'em4']) self._stub_available_nics(['em1', 'em2', 'em3', 'em4']) mapping = {'nic1': 'em1', 'nic2': 'em3'} expected = {'nic1': 'em1', 'nic2': 'em3', 'nic4': 'em4'} self.assertEqual(expected, objects._mapped_nics(nic_mapping=mapping))
def test_mapped_nics_map_error_notactive(self): self._stub_active_nics(['em2']) self._stub_available_nics(['em1', 'em2', 'em3']) mapping = {'nic2': 'em1'} expected = {'nic1': 'em2', 'nic2': 'em1'} self.assertEqual(expected, objects._mapped_nics(nic_mapping=mapping))
def test_mapped_nics_no_active(self): self._stub_active_nics([]) expected = {} # This only emits a warning, so it should still work self.assertEqual(expected, objects._mapped_nics())