fix: set transaction user based on session info, when applicable
combined with `--runas` CLI param, this gives "any" command a way to assign authorship for versioning
This commit is contained in:
parent
1fc280eff1
commit
d22a9963bf
2 changed files with 61 additions and 27 deletions
|
|
@ -55,9 +55,20 @@ class TestWuttaContinuumPlugin(DataTestCase):
|
|||
self.assertEqual(plugin.get_remote_addr(None, self.session), "127.0.0.1")
|
||||
|
||||
def test_user_id(self):
|
||||
model = self.app.model
|
||||
plugin = self.make_plugin()
|
||||
|
||||
fred = model.User(username="fred")
|
||||
self.session.add(fred)
|
||||
self.session.commit()
|
||||
|
||||
# empty by default
|
||||
self.assertIsNone(plugin.get_user_id(None, self.session))
|
||||
|
||||
# but session can declare one
|
||||
self.session.info["continuum_user_id"] = fred.uuid
|
||||
self.assertEqual(plugin.get_user_id(None, self.session), fred.uuid)
|
||||
|
||||
def test_transaction_args(self):
|
||||
plugin = self.make_plugin()
|
||||
with patch.object(socket, "gethostbyname", return_value="127.0.0.1"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue