Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setup_method(self, method):
Connections.deregister_all()
Connections.register("dummy", DummyConnectionPlugin)
Connections.register("another_dummy", AnotherDummyConnectionPlugin)
def test_register_already_registered_same(self):
Connections.register("dummy", DummyConnectionPlugin)
assert Connections.available["dummy"] == DummyConnectionPlugin
def test_deregister_nonexistent(self):
with pytest.raises(ConnectionPluginNotRegistered):
Connections.deregister("nonexistent_dummy")
def test_deregister_all(self):
Connections.deregister_all()
assert Connections.available == {}
def test_get_plugin(self):
assert Connections.get_plugin("dummy") == DummyConnectionPlugin
assert Connections.get_plugin("another_dummy") == AnotherDummyConnectionPlugin
assert len(Connections.available) == 2
def register_default_connection_plugins() -> None:
Connections.register("napalm", Napalm)
Connections.register("netconf", Netconf)
Connections.register("netmiko", Netmiko)
Connections.register("paramiko", Paramiko)
def register_default_connection_plugins() -> None:
Connections.register("napalm", Napalm)
Connections.register("netmiko", Netmiko)
Connections.register("paramiko", Paramiko)
def register_default_connection_plugins() -> None:
Connections.register("napalm", Napalm)
Connections.register("netconf", Netconf)
Connections.register("netmiko", Netmiko)
Connections.register("paramiko", Paramiko)
def register_default_connection_plugins() -> None:
Connections.register("napalm", Napalm)
Connections.register("netmiko", Netmiko)
Connections.register("paramiko", Paramiko)
def __init__(
self, name: str, defaults: Optional[Defaults] = None, **kwargs
) -> None:
self.name = name
self.defaults = defaults or Defaults()
self.connections: Connections = Connections()
super().__init__(**kwargs)