test_logic.py 文件源码

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

项目:ckanext-validation 作者: frictionlessdata 项目源码 文件源码
def test_validation_passes_on_upload(self, mock_open):

        dataset = factories.Dataset(resources=[
            {
                'url': 'https://example.com/data.csv'
            }
        ])

        valid_file = StringIO.StringIO()
        valid_file.write(INVALID_CSV)

        mock_upload = MockFieldStorage(valid_file, 'valid.csv')

        valid_stream = io.BufferedReader(io.BytesIO(VALID_CSV))

        with mock.patch('io.open', return_value=valid_stream):

            resource = call_action(
                'resource_update',
                id=dataset['resources'][0]['id'],
                format='CSV',
                upload=mock_upload
            )

        assert_equals(resource['validation_status'], 'success')
        assert 'validation_timestamp' in resource
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号