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)
评论列表
文章目录