24 lines
681 B
Python
24 lines
681 B
Python
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()
|