Fix NetBox string path compatibility
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
import _bootstrap # noqa: F401
|
||||
|
||||
from netbox_plugin_store.runtime import _netbox_root
|
||||
|
||||
|
||||
class RuntimePathTests(unittest.TestCase):
|
||||
def test_netbox_root_falls_back_from_string_base_dir(self):
|
||||
settings = SimpleNamespace(BASE_DIR="/opt/netbox/netbox")
|
||||
|
||||
self.assertEqual(_netbox_root(settings), Path("/opt/netbox"))
|
||||
|
||||
def test_explicit_netbox_root_accepts_string_paths(self):
|
||||
settings = SimpleNamespace(BASE_DIR="/srv/netbox/app", NETBOX_ROOT="/opt/netbox")
|
||||
|
||||
self.assertEqual(_netbox_root(settings), Path("/opt/netbox"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user