<s> """<STR_LIT>""" <EOL> import abc <EOL> import fixtures <EOL> from neutron_lib import exceptions as n_exc <EOL> import six <EOL> from neutron import context <EOL> from neutron import manager <EOL> from neutron . tests import base <EOL> from neutron . tests . unit import testlib_api <EOL> @ six . add_metaclass ( abc . ABCMeta ) <EOL> class AbstractClientFixture ( fixtures . Fixture ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractproperty <EOL> def NotFound ( self ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def create_network ( self , ** kwargs ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def update_network ( self , id_ , ** kwargs ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def get_network ( self , id_ , fields = None ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def get_networks ( self , filters = None , fields = None , <EOL> sorts = None , limit = None , marker = None , page_reverse = False ) : <EOL> pass <EOL> @ abc . abstractmethod <EOL> def delete_network ( self , id_ ) : <EOL> pass <EOL> class PluginClientFixture ( AbstractClientFixture ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , plugin_conf ) : <EOL> super ( PluginClientFixture , self ) . __init__ ( ) <EOL> self . plugin_conf = plugin_conf <EOL> def _setUp ( self ) : <EOL> super ( PluginClientFixture , self ) . _setUp ( ) <EOL> self . useFixture ( testlib_api . SqlFixture ( ) ) <EOL> self . useFixture ( self . plugin_conf ) <EOL> self . useFixture ( base . PluginFixture ( self . plugin_conf . plugin_name ) ) <EOL> @ property <EOL> def ctx ( self ) : <EOL> if not hasattr ( self , '<STR_LIT>' ) : <EOL> self . _ctx = context . Context ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> return self . _ctx <EOL> @ property <EOL> def plugin ( self ) : <EOL> return manager . NeutronManager . get_plugin ( ) <EOL> @ property <EOL> def NotFound ( self ) : <EOL> return n_exc . NetworkNotFound <EOL> def create_network ( self , ** kwargs ) : <EOL> kwargs . setdefault ( '<STR_LIT>' , True ) <EOL> kwargs . setdefault ( '<STR_LIT>' , False ) <EOL> kwargs . setdefault ( '<STR_LIT>' , self . ctx . tenant_id ) <EOL> data = dict ( network = kwargs ) <EOL> result = self . plugin . create_network ( self . ctx , data ) <EOL> return base . AttributeDict ( result ) <EOL> def update_network ( self , id_ , ** kwargs ) : <EOL> data = dict ( network = kwargs ) <EOL> result = self . plugin . update_network ( self . ctx , id_ , data ) <EOL> return base . AttributeDict ( result ) <EOL> def get_network ( self , * args , ** kwargs ) : <EOL> result = self . plugin . get_network ( self . ctx , * args , ** kwargs ) <EOL> return base . AttributeDict ( result ) <EOL> def get_networks ( self , * args , ** kwargs ) : <EOL> result = self . plugin . get_networks ( self . ctx , * args , ** kwargs ) <EOL> return [ base . AttributeDict ( x ) for x in result ] <EOL> def delete_network ( self , id_ ) : <EOL> self . plugin . delete_network ( self . ctx , id_ ) </s>
