3
0
Fork 0

fix: fallback to default continuum plugin logic, when no request

this solves the issue when running via command line, where it
previously would always set user/IP to None since the wuttaweb plugin
overrides the default when installed
This commit is contained in:
Lance Edgar 2025-12-29 11:17:50 -06:00
parent 53817a9e32
commit ca20fdfd03
2 changed files with 16 additions and 8 deletions

View file

@ -21,11 +21,15 @@ class TestWuttaWebContinuumPlugin(WebTestCase):
def test_get_remote_addr(self):
plugin = self.make_plugin()
with patch.object(mod, "get_current_request", return_value=None):
self.assertIsNone(plugin.get_remote_addr(None, self.session))
# typical request from client IP
self.request.client_addr = "172.237.145.181"
self.assertEqual(plugin.get_remote_addr(None, self.session), "172.237.145.181")
self.request.client_addr = "127.0.0.1"
self.assertEqual(plugin.get_remote_addr(None, self.session), "127.0.0.1")
# pretend we have no request; IP will be random string
# (probably 127.0.0.1 but can't guarentee that..)
with patch.object(mod, "get_current_request", return_value=None):
addr = plugin.get_remote_addr(None, self.session)
self.assertIsInstance(addr, str)
def test_get_user_id(self):
plugin = self.make_plugin()