<s> import unittest <EOL> from openstack import exceptions <EOL> from openstack . orchestration . v1 import stack <EOL> from openstack . tests . functional import base <EOL> from openstack . tests . functional . network . v2 import test_network <EOL> @ unittest . skip ( "<STR_LIT>" ) <EOL> class TestStack ( base . BaseFunctionalTest ) : <EOL> NAME = '<STR_LIT>' <EOL> stack = None <EOL> network = None <EOL> subnet = None <EOL> cidr = '<STR_LIT>' <EOL> @ classmethod <EOL> def setUpClass ( cls ) : <EOL> super ( TestStack , cls ) . setUpClass ( ) <EOL> if cls . conn . compute . find_keypair ( cls . NAME ) is None : <EOL> cls . conn . compute . create_keypair ( name = cls . NAME ) <EOL> image = next ( cls . conn . image . images ( ) ) <EOL> tname = "<STR_LIT>" <EOL> with open ( tname ) as f : <EOL> template = f . read ( ) <EOL> cls . network , cls . subnet = test_network . create_network ( cls . conn , <EOL> cls . NAME , <EOL> cls . cidr ) <EOL> parameters = { <EOL> '<STR_LIT:image>' : image . id , <EOL> '<STR_LIT>' : cls . NAME , <EOL> '<STR_LIT>' : cls . network . id , <EOL> } <EOL> sot = cls . conn . orchestration . create_stack ( <EOL> name = cls . NAME , <EOL> parameters = parameters , <EOL> template = template , <EOL> ) <EOL> assert isinstance ( sot , stack . Stack ) <EOL> cls . assertIs ( True , ( sot . id is not None ) ) <EOL> cls . stack = sot <EOL> cls . assertIs ( cls . NAME , sot . name ) <EOL> cls . conn . orchestration . wait_for_status ( <EOL> sot , status = '<STR_LIT>' , failures = [ '<STR_LIT>' ] ) <EOL> @ classmethod <EOL> def tearDownClass ( cls ) : <EOL> super ( TestStack , cls ) . tearDownClass ( ) <EOL> cls . conn . orchestration . delete_stack ( cls . stack , ignore_missing = False ) <EOL> cls . conn . compute . delete_keypair ( cls . NAME ) <EOL> try : <EOL> cls . conn . orchestration . wait_for_status ( <EOL> cls . stack , '<STR_LIT>' ) <EOL> except exceptions . NotFoundException : <EOL> pass <EOL> cls . linger_for_delete ( ) <EOL> test_network . delete_network ( cls . conn , cls . network , cls . subnet ) <EOL> def test_list ( self ) : <EOL> names = [ o . name for o in self . conn . orchestration . stacks ( ) ] <EOL> self . assertIn ( self . NAME , names ) </s>
