Esempio n. 1
0
 def test_start(self, mock_create, mock_get_vm,
                mock_set_ip, mock_time):
     uc = Undercloud('img_path', 'tplt_path', external_network=True)
     uc.vm = MagicMock()
     uc.vm.isActive.return_value = False
     mock_set_ip.return_value = True
     uc.start()
Esempio n. 2
0
 def test_start_no_ip(self, mock_create, mock_get_vm,
                      mock_set_ip, mock_time):
     uc = Undercloud('img_path', 'tplt_path', external_network=True)
     uc.vm = MagicMock()
     uc.vm.isActive.return_value = True
     mock_set_ip.return_value = False
     assert_raises(ApexUndercloudException, uc.start)
Esempio n. 3
0
 def test_set_ip(self, mock_get_vm, mock_create):
     uc = Undercloud('img_path', 'tplt_path', external_network=True)
     uc.vm = MagicMock()
     if_addrs = {'item1': {'addrs': [{'type': libvirt.VIR_IP_ADDR_TYPE_IPV4,
                                      'addr': 'ipaddress'}]},
                 'item2': {'addrs': [{'type': libvirt.VIR_IP_ADDR_TYPE_IPV4,
                                      'addr': 'ipaddress'}]}}
     uc.vm.interfaceAddresses.return_value = if_addrs
     assert_true(uc._set_ip())