def test_get_host_ip_hostname_resolvable(self, _query):
     data = MagicMock()
     data.address = '10.5.0.1'
     _query.return_value = [data]
     self.assertEquals(quantum_contexts.get_host_ip('myhost.example.com'),
                       '10.5.0.1')
     _query.assert_called_with('myhost.example.com', 'A')
 def test_get_host_ip_hostname_resolvable(self, _query):
     data = MagicMock()
     data.address = "10.5.0.1"
     _query.return_value = [data]
     self.assertEquals(quantum_contexts.get_host_ip("myhost.example.com"), "10.5.0.1")
     _query.assert_called_with("myhost.example.com", "A")
 def test_get_host_ip_noarg(self):
     self.unit_get.return_value = "10.5.0.1"
     self.assertEquals(quantum_contexts.get_host_ip(), "10.5.0.1")
 def test_get_host_ip_already_ip(self):
     self.assertEquals(quantum_contexts.get_host_ip("10.5.0.1"), "10.5.0.1")