jobs_tests.py 文件源码

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

项目:birdseye-server 作者: DramaticLiberty 项目源码 文件源码
def test_image_to_obs(self, mock_ps, mock_dl):
        session = jobs.db_session()
        session.query(bm.Observation).delete()
        session.commit()
        obs = session.query(bm.Observation).all()
        nt.assert_equals(obs, [])

        teardown_singleton_pubsub()
        mock_dl.return_value = [(7.0, 'mockingbird')]

        jobs.image_to_observation(self.file_path_gps, self.file_path)

        obs = session.query(bm.Observation).all()

        # TODO: test better what's in this obs
        nt.assert_equals(len(obs), 1)

        mock_dl.assert_called_once_with(self.file_path)
        mock_ps.assert_called_once_with()
        # as long as we return the repr of geometry, we cannot do this assert:
        # mock_ps().publish.assert_called_once_with(obs[0].as_public_dict())
        nt.assert_equals(mock_ps().publish.call_count, 1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号