test_ofx_transaction.py 文件源码

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

项目:biweeklybudget 作者: jantman 项目源码 文件源码
def test_unreconciled(self):
        m_db = Mock()
        m_q = Mock(spec_set=Query)
        m_filt = Mock(spec_set=Query)
        m_db.query.return_value = m_q
        m_q.filter.return_value = m_filt
        res = OFXTransaction.unreconciled(m_db)
        assert res == m_filt
        assert len(m_db.mock_calls) == 2
        assert m_db.mock_calls[0] == call.query(OFXTransaction)
        kall = m_db.mock_calls[1]
        assert kall[0] == 'query().filter'
        expected1 = OFXTransaction.reconcile.__eq__(null())
        cutoff = datetime(2017, 3, 17, 0, 0, 0, tzinfo=UTC)
        expected2 = OFXTransaction.date_posted.__ge__(cutoff)
        expected3 = OFXTransaction.account.has(reconcile_trans=True)
        assert len(kall[1]) == 3
        assert str(expected1) == str(kall[1][0])
        assert binexp_to_dict(expected2) == binexp_to_dict(kall[1][1])
        assert str(kall[1][2]) == str(expected3)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号