Skip to content

Commit

Permalink
Merge pull request #397 from dvaccarosenna/issue/332
Browse files Browse the repository at this point in the history
Replace underscores in plugin app name with dashes
  • Loading branch information
zachmoody committed Jul 30, 2021
2 parents 4efcab0 + 4909ed1 commit cf9a4c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pynetbox/core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit cf9a4c8

Please sign in to comment.