<s> from cafe . drivers . unittest . decorators import tags , data_driven_test , DataDrivenFixture <EOL> from cafe . drivers . unittest . datasets import DatasetList <EOL> from cloudroast . blockstorage . volumes_api . fixtures import VolumesTestFixture <EOL> from cloudcafe . blockstorage . datasets import BlockstorageDatasets <EOL> class QuotaTestDatasets ( BlockstorageDatasets ) : <EOL> @ classmethod <EOL> def valid_quota_names ( cls ) : <EOL> """<STR_LIT>""" <EOL> quota_test_dataset = DatasetList ( ) <EOL> resources = [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] <EOL> vol_types = cls . _get_volume_type_names ( ) <EOL> for resource in resources : <EOL> quota_test_dataset . append_new_dataset ( <EOL> resource , { "<STR_LIT>" : resource } ) <EOL> for vol_name in vol_types : <EOL> resource_key = "<STR_LIT>" . format ( <EOL> resource = resource , vol_name = vol_name ) <EOL> quota_test_dataset . append_new_dataset ( <EOL> resource_key , { "<STR_LIT>" : resource_key } ) <EOL> return quota_test_dataset <EOL> @ DataDrivenFixture <EOL> class QuotaTest ( VolumesTestFixture ) : <EOL> def test_negative_show_default_quota_with_garbage_tenant_id ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . volumes . client . get_default_quotas ( <EOL> "<STR_LIT>" ) <EOL> assert not resp . ok , ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_show_default_quota ( self ) : <EOL> """<STR_LIT>""" <EOL> resp = self . volumes . client . get_default_quotas ( <EOL> self . volumes . auth . tenant_id ) <EOL> self . assertExactResponseStatus ( <EOL> resp , <NUM_LIT:200> , msg = "<STR_LIT>" ) <EOL> @ data_driven_test ( QuotaTestDatasets . valid_quota_names ( ) ) <EOL> def ddtest_verify_quota ( self , quota_name ) : <EOL> """<STR_LIT>""" <EOL> resp = self . volumes . client . get_default_quotas ( <EOL> self . volumes . auth . tenant_id ) <EOL> self . assertResponseDeserializedAndOk ( resp ) <EOL> keylist = vars ( resp . entity ) . keys ( ) <EOL> msg = "<STR_LIT>" . format ( <EOL> quota_name ) <EOL> self . assertIn ( quota_name , keylist , msg = msg ) </s>
