def test_resource_form_update_valid(self, mock_open):
dataset = Dataset(resources=[
{
'url': 'https://example.com/data.csv'
}
])
app = self._get_test_app()
env, response = _get_resource_update_page_as_sysadmin(
app, dataset['id'], dataset['resources'][0]['id'])
form = response.forms['resource-edit']
upload = ('upload', 'valid.csv', VALID_CSV)
valid_stream = io.BufferedReader(io.BytesIO(VALID_CSV))
with mock.patch('io.open', return_value=valid_stream):
submit_and_follow(app, form, env, 'save', upload_files=[upload])
dataset = call_action('package_show', id=dataset['id'])
assert_equals(dataset['resources'][0]['validation_status'], 'success')
assert 'validation_timestamp' in dataset['resources'][0]
评论列表
文章目录