def test____enter____exit__(self): sdk = Sdk() vm_name = f"test____enter____exit__{random_string()}" with Temp_VM(vm_name) as vm: assert vm.name() == vm_name assert sdk.find_by_name(vm_name).name() == vm_name # search VM and confirm it is there assert sdk.find_by_name(vm_name) == None # search outsite the `with` statement and confirm that is NOT there
class test_Temp_VM(TestCase): def setUp(self): self.temp_vm = Temp_VM() def test__init__(self): assert "unit_tests__temp_vm_" in self.temp_vm.vm_name def test_create__delete(self): vm = self.temp_vm.create() assert self.temp_vm.vm == vm assert self.temp_vm.vm_name == vm.name() delete_task = self.temp_vm.delete() assert delete_task.info.state == "success" def test____enter____exit__(self): sdk = Sdk() vm_name = f"test____enter____exit__{random_string()}" with Temp_VM(vm_name) as vm: assert vm.name() == vm_name assert sdk.find_by_name(vm_name).name() == vm_name # search VM and confirm it is there assert sdk.find_by_name(vm_name) == None # search outsite the `with` statement and confirm that is NOT there
def setUpClass(cls) -> None: test_VM.temp_vm = Temp_VM(vm_name=test_VM.vm_name) test_VM.temp_vm.create()
def setUp(self): self.temp_vm = Temp_VM()
def setUpClass(cls) -> None: vm_name : str = cls.vm_name or cls.vm_name cls.temp_vm : Temp_VM = Temp_VM(vm_name=vm_name) cls.sdk : Sdk = cls.temp_vm.sdk cls.vm : VM = cls.temp_vm.create()
def setUpClass(cls) -> None: vm_name: str = cls.vm_name or TestCase_VM.vm_name TestCase_VM.temp_vm: Temp_VM = Temp_VM(vm_name=vm_name) TestCase_VM.sdk: Sdk = TestCase_VM.temp_vm.sdk TestCase_VM.vm: VM = TestCase_VM.temp_vm.create()