From e5dc40ded5696a5f30177307fbdd910d21abc9cc Mon Sep 17 00:00:00 2001 From: Daniel Vaccaro-Senna Date: Mon, 26 Jul 2021 16:11:09 +0100 Subject: [PATCH 1/2] Replace underscores in plugin app name with dash --- pynetbox/core/app.py | 2 +- tests/test_app.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pynetbox/core/app.py b/pynetbox/core/app.py index cf0022a6..312eb50c 100644 --- a/pynetbox/core/app.py +++ b/pynetbox/core/app.py @@ -161,7 +161,7 @@ def __setstate__(self, d): self.__dict__.update(d) def __getattr__(self, name): - return App(self.api, "plugins/{}".format(name)) + return App(self.api, "plugins/{}".format(name.replace("_", "-"))) def installed_plugins(self): """ Returns raw response with installed plugins diff --git a/tests/test_app.py b/tests/test_app.py index eb90259e..2b031156 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -73,3 +73,8 @@ def test_installed_plugins(self, *_): plugins = api.plugins.installed_plugins() self.assertEqual(len(plugins), 1) self.assertEqual(plugins[0]["name"], "test_plugin") + + def test_plugin_app_name(self, *_): + api = pynetbox.api(host, **def_kwargs) + test_plugin = api.plugins.test_plugin + self.assertEqual(test_plugin.name, 'plugins/test-plugin') From 4909ed126551c90764f7a12ef7b9c880be75e90a Mon Sep 17 00:00:00 2001 From: Daniel Vaccaro-Senna Date: Tue, 27 Jul 2021 10:28:01 +0100 Subject: [PATCH 2/2] Replace use of single quotes in test --- tests/test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_app.py b/tests/test_app.py index 2b031156..bee3506b 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -77,4 +77,4 @@ def test_installed_plugins(self, *_): def test_plugin_app_name(self, *_): api = pynetbox.api(host, **def_kwargs) test_plugin = api.plugins.test_plugin - self.assertEqual(test_plugin.name, 'plugins/test-plugin') + self.assertEqual(test_plugin.name, "plugins/test-plugin")