def __init__(self, menaces, processes, os_auth_info): self.client = OS_Client(menaces, processes, os_auth_info) assert self.client != None
class TestOSClient: def __init__(self, menaces, processes, os_auth_info): self.client = OS_Client(menaces, processes, os_auth_info) assert self.client != None def test_kill_instance(self, instanceId): instance = self.client.get_instance(instanceId) assert instance != None self.client.kill_instance(instanceId) time.sleep(5) instance = self.client.get_instance(instanceId, latest=True) assert instance.status == "SHUTOFF" print "Instance successfully shutoff" self.client._start_instance(instanceId) time.sleep(5) instance = self.client.get_instance(instanceId, latest=True) assert instance.status == "ACTIVE" print "Instance successfully restarted" def test_kill_volume(self, instanceId, volume_id): instance = self.client.get_instance(instanceId) assert instance != None volume = self.client.get_volume(instanceId, volume_id) self.client.kill_volume(instanceId, volume_id) time.sleep(5) assert self.client.get_volume(instanceId, volume_id) == None print "Volume successfully detached" self.client._reattach_volume(volume) assert self.client.get_volume(instanceId, volume_id) == volume print "Volume successfully reattached"