def test_resource_form_create_valid(self, mock_open):
dataset = Dataset()
app = self._get_test_app()
env, response = _get_resource_new_page_as_sysadmin(app, dataset['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]
评论列表
文章目录