test_events.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:thorn 作者: robinhood 项目源码 文件源码
def test_on_signal__no_transaction(self, partial, on_commit):
        # test with signal_honor_transaction and not in transaction
        event = self.mock_event('x.y', sender_field=None)
        event.signal_honors_transaction = True
        event._on_signal = Mock(name='_on_signal')
        instance = self.Model()
        on_commit.side_effect = TransactionManagementError()
        assert django.TransactionManagementError is TransactionManagementError
        event.on_signal(instance, kw=1)
        partial.assert_called_once_with(event._on_signal, instance, {'kw': 1})
        on_commit.assert_called_once_with(partial())
        partial.return_value.assert_called_once_with()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号