def test_query_instance_ready(self): ''' IP address assigned, and VM is ready ''' reply = (200, {'primaryIp': '1.1.1.1', 'state': 'running'}) with patch.object(joyent, 'show_instance', return_value=reply): result = joyent.query_instance(self.vm_) self.assertTrue(joyent.__utils__['cloud.fire_event'].called_once()) self.assertEqual(result, '1.1.1.1')
def test_query_instance_ready(self): """ IP address assigned, and VM is ready """ reply = (200, {"primaryIp": "1.1.1.1", "state": "running"}) with patch.object(joyent, "show_instance", return_value=reply): result = joyent.query_instance(self.vm_) self.assertTrue(joyent.__utils__["cloud.fire_event"].called_once()) self.assertEqual(result, "1.1.1.1")
def test_query_instance_init(self): ''' Initial provisioning, no IP assigned ''' # Not yet reachable reply = (200, {'state': 'provisioning'}) with patch.object(joyent, 'show_instance', return_value=reply): result = joyent.query_instance(self.vm_) self.assertTrue(joyent.__utils__['cloud.fire_event'].called_once()) self.assertEqual(result, None)
def test_query_instance_init(self): """ Initial provisioning, no IP assigned """ # Not yet reachable reply = (200, {"state": "provisioning"}) with patch.object(joyent, "show_instance", return_value=reply): result = joyent.query_instance(self.vm_) self.assertTrue(joyent.__utils__["cloud.fire_event"].called_once()) self.assertEqual(result, None)