

def test_signals_with_switch_db(self):
    connect('mongoenginetest')
    register_connection('testdb-1', 'mongoenginetest2')
    ei = self.ExplicitId(id=123)
    ei.switch_db('testdb-1')
    self.assertEqual(self.get_signal_output(self.save), ['Is created'])
    ei.switch_db('testdb-1')
    self.assertEqual(self.get_signal_output(ei.save), ['Is updated'])
    ei.switch_db('testdb-1', keep_created=False)
    self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
    ei.switch_db('testdb-1', keep_created=False)
    self.assertEqual(self.get_signal_output(ei.save), ['Is created'])

dataset/ETHPy150Open MongoEngine/mongoengine/tests/test_signals.py SignalTests.test_signals_with_switch_db/VarMisuse@48/81 `ei`->`self`