def test07_set_vm_lifetime(self): """Happy path test to verify that the TTL can be manipulated on VM instances.""" # Init lifetime = 25 # Construct mock return object. json_body = '{"ok": true}' resp = _HttpResponse(200, json_body) # Patch with patch.object(service, '_make_request', return_value=resp) as mock_func: service.set_vm_lifetime(self.vmpooler_url, self.hostname, lifetime, self.auth_token)
def test07_set_vm_lifetime(self): """Happy path test to verify that the TTL can be manipulated on VM instances.""" # Init lifetime = 25 # Construct mock return object. json_body = '{"ok": true}' resp = _HttpResponse(200, json_body) # Patch with patch.object(service, '_make_request', return_value=resp) as mock_func: service.set_vm_lifetime(self.vmpooler_hostname, self.hostname, lifetime, self.auth_token)
def test08_set_vm_lifetime_neg(self): """Negative test case for attempting to set TTL on VM instance with invalid credentials.""" # Init lifetime = 25 # Construct mock return object. json_body = '{"ok": false}' resp = _HttpResponse(200, json_body) # Patch with patch.object(service, '_make_request', return_value=resp) as mock_func: with self.assertRaises(RuntimeError) as cm: service.set_vm_lifetime(self.vmpooler_url, self.hostname, lifetime, self.auth_token) excep = cm.exception self.assertEqual(excep.msg, 'Invalid credentials provided!')
def test08_set_vm_lifetime_neg(self): """Negative test case for attempting to set TTL on VM instance with invalid credentials.""" # Init lifetime = 25 # Construct mock return object. json_body = '{"ok": false}' resp = _HttpResponse(200, json_body) # Patch with patch.object(service, '_make_request', return_value=resp) as mock_func: with self.assertRaises(RuntimeError) as cm: service.set_vm_lifetime(self.vmpooler_hostname, self.hostname, lifetime, self.auth_token) excep = cm.exception self.assertEqual(excep.msg, 'Invalid credentials provided!')