<s> from py2neo import Resource , remote <EOL> from py2neo . ext import ServerPlugin , UnmanagedExtension <EOL> from test . util import GraphTestCase <EOL> from test . compat import patch <EOL> class FakePlugin ( ServerPlugin ) : <EOL> def __init__ ( self , graph ) : <EOL> super ( FakePlugin , self ) . __init__ ( graph , "<STR_LIT>" ) <EOL> class NaughtyPlugin ( ServerPlugin ) : <EOL> def __init__ ( self , graph ) : <EOL> super ( NaughtyPlugin , self ) . __init__ ( graph , "<STR_LIT>" ) <EOL> class ServerPluginTestCase ( GraphTestCase ) : <EOL> def test_can_init_server_plugin ( self ) : <EOL> remote_graph = remote ( self . graph ) <EOL> metadata = remote_graph . metadata <EOL> metadata [ "<STR_LIT>" ] [ "<STR_LIT>" ] = { } <EOL> self . graph . __remote__ = Resource ( remote_graph . uri , metadata ) <EOL> plugin = FakePlugin ( self . graph ) <EOL> assert plugin . resources == { } <EOL> def test_cannot_init_non_existent_server_plugin ( self ) : <EOL> with self . assertRaises ( LookupError ) : <EOL> NaughtyPlugin ( self . graph ) <EOL> class FakeExtension ( UnmanagedExtension ) : <EOL> def __init__ ( self , graph ) : <EOL> super ( FakeExtension , self ) . __init__ ( graph , "<STR_LIT>" ) <EOL> class NaughtyExtension ( UnmanagedExtension ) : <EOL> def __init__ ( self , graph ) : <EOL> super ( NaughtyExtension , self ) . __init__ ( graph , "<STR_LIT>" ) <EOL> class UnmanagedExtensionTestCase ( GraphTestCase ) : <EOL> def test_can_init_unmanaged_extension ( self ) : <EOL> with patch ( "<STR_LIT>" ) : <EOL> plugin = FakeExtension ( self . graph ) <EOL> assert plugin . remote . uri == "<STR_LIT>" <EOL> def test_cannot_init_non_existent_server_plugin ( self ) : <EOL> with self . assertRaises ( NotImplementedError ) : <EOL> NaughtyExtension ( self . graph ) </s>
