

def test_signals_with_switch_collection(self):
    ei = self.ExplicitId(id=123)
    ei.switch_collection('explicit__1')
    self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
    ei.switch_collection('explicit__1')
    self.assertEqual(self.get_signal_output(ei.save), ['Is updated'])
    ei.switch_collection('explicit__1', keep_created=False)
    self.assertEqual(self.get_signal_output(ei.save), ['Is created'])
    ei.switch_collection('explicit__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_collection/original