#NEWLINE# @ test . create_stubs ( { #NEWLINE# #INDENT# api . nova : ( 'tenant_quota_get' , 'flavor_list' , 'server_list' ) , #NEWLINE# api . network : ( 'floating_ip_pools_list' , 'floating_ip_supported' , 'security_group_list' , 'tenant_floating_ip_list' ) , #NEWLINE# api . neutron : ( 'is_extension_supported' , 'tenant_quota_get' , 'network_list' , 'router_list' , 'subnet_list' ) , #NEWLINE# api . base : ( 'is_service_enabled' , ) , #NEWLINE# api . cinder : ( 'is_volume_service_enabled' , ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# @ test . update_settings ( OPENSTACK_NEUTRON_NETWORK = { #NEWLINE# #INDENT# 'enable_quotas' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# def test_correct_quotas_displayed( self ) : #NEWLINE# #INDENT# servers = [ s for s in self . servers . list ( ) if ( s . tenant_id == self . request . user . tenant_id ) ] #NEWLINE# api . cinder . is_volume_service_enabled ( IsA ( http . HttpRequest ) ) . AndReturn ( False ) #NEWLINE# api . base . is_service_enabled ( IsA ( http . HttpRequest ) , 'network' ) . MultipleTimes ( ) . AndReturn ( True ) #NEWLINE# api . nova . tenant_quota_get ( IsA ( http . HttpRequest ) , '1' ) . AndReturn ( self . quotas . first ( ) ) #NEWLINE# api . nova . flavor_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . flavors . list ( ) ) #NEWLINE# search_opts = { #NEWLINE# #INDENT# 'tenant_id' : self . request . user . tenant_id , #NEWLINE# #UNINDENT# } #NEWLINE# api . nova . server_list ( IsA ( http . HttpRequest ) , search_opts = search_opts , all_tenants = True ) . AndReturn ( [ url , False ] ) #NEWLINE# api . neutron . is_extension_supported ( IsA ( http . HttpRequest ) , 'security-group' ) . AndReturn ( True ) #NEWLINE# api . neutron . is_extension_supported ( IsA ( http . HttpRequest ) , 'quotas' ) . AndReturn ( True ) #NEWLINE# api . neutron . tenant_quota_get ( IsA ( http . HttpRequest ) , self . tenant . id ) . AndReturn ( self . neutron_quotas . first ( ) ) #NEWLINE# api . neutron . router_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . routers . list ( ) ) #NEWLINE# api . neutron . subnet_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . subnets . list ( ) ) #NEWLINE# api . neutron . network_list ( IsA ( http . HttpRequest ) , shared = False ) . AndReturn ( self . networks . list ( ) ) #NEWLINE# api . neutron . network_list ( IsA ( http . HttpRequest ) , shared = True ) . AndReturn ( list ( ) ) #NEWLINE# api . network . floating_ip_supported ( IsA ( http . HttpRequest ) ) . AndReturn ( True ) #NEWLINE# api . network . tenant_floating_ip_list ( IsA ( http . HttpRequest ) ) . MultipleTimes ( ) . AndReturn ( self . floating_ips . list ( ) ) #NEWLINE# api . network . floating_ip_pools_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . pools . list ( ) ) #NEWLINE# api . network . security_group_list ( IsA ( http . HttpRequest ) ) . AndReturn ( self . security_groups . list ( ) ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# url = reverse ( ( '%s:allocate' % NAMESPACE ) ) #NEWLINE# res = self . client . get ( url ) #NEWLINE# self . assertEqual ( res . context [ 'usages' ] [ 'floating_ips' ] [ 'quota' ] , self . neutron_quotas . first ( ) . get ( 'floatingip' ) . limit )