wip
gitea/wcs/pipeline/head There was a failure building this commit
Details
gitea/wcs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
9df6d42265
commit
09ca5e2db8
|
@ -708,6 +708,26 @@ def test_cards_import_csv(pub, local_user, auth):
|
|||
assert resp.json == {'err': 0}
|
||||
assert carddef.data_class().count() == 2
|
||||
assert {x.data['0'] for x in carddef.data_class().select()} == {'first entry', 'second entry'}
|
||||
assert {x.digests['default'] for x in carddef.data_class().select()} == {
|
||||
'bla first entry xxx',
|
||||
'bla second entry xxx',
|
||||
}
|
||||
|
||||
carddef.id_template = '{{ form_var_foo }}'
|
||||
carddef.store()
|
||||
carddef.data_class().wipe()
|
||||
resp = put_url(
|
||||
'/api/cards/test/import-csv',
|
||||
params=b'foobar;foobar2\nfirst entry;plop\nsecond entry;plop\n',
|
||||
headers={'content-type': 'text/csv'},
|
||||
)
|
||||
assert resp.json == {'err': 0}
|
||||
assert carddef.data_class().count() == 2
|
||||
assert {x.data['0'] for x in carddef.data_class().select()} == {'first entry', 'second entry'}
|
||||
assert {x.digests['default'] for x in carddef.data_class().select()} == {
|
||||
'bla first entry xxx',
|
||||
'bla second entry xxx',
|
||||
}
|
||||
|
||||
# async mode
|
||||
carddef.data_class().wipe()
|
||||
|
@ -720,6 +740,10 @@ def test_cards_import_csv(pub, local_user, auth):
|
|||
# afterjobs are not async in tests: job is already completed during request
|
||||
assert carddef.data_class().count() == 2
|
||||
assert {x.data['0'] for x in carddef.data_class().select()} == {'first entry', 'second entry'}
|
||||
assert {x.digests['default'] for x in carddef.data_class().select()} == {
|
||||
'bla first entry xxx',
|
||||
'bla second entry xxx',
|
||||
}
|
||||
assert resp.json['err'] == 0
|
||||
assert 'job' in resp.json['data']
|
||||
job_id = resp.json['data']['job']['id']
|
||||
|
@ -845,6 +869,26 @@ def test_cards_import_json(pub, local_user, auth):
|
|||
assert resp.json == {'err': 0}
|
||||
assert carddef.data_class().count() == 2
|
||||
assert {x.data['0'] for x in carddef.data_class().select()} == {'first entry', 'second entry'}
|
||||
assert {x.digests['default'] for x in carddef.data_class().select()} == {
|
||||
'bla first entry xxx',
|
||||
'bla second entry xxx',
|
||||
}
|
||||
|
||||
carddef.id_template = '{{ form_var_foo }}'
|
||||
carddef.store()
|
||||
carddef.data_class().wipe()
|
||||
resp = put_url(
|
||||
'/api/cards/test/import-json',
|
||||
data,
|
||||
headers={'content-type': 'application/json'},
|
||||
)
|
||||
assert resp.json == {'err': 0}
|
||||
assert carddef.data_class().count() == 2
|
||||
assert {x.data['0'] for x in carddef.data_class().select()} == {'first entry', 'second entry'}
|
||||
assert {x.digests['default'] for x in carddef.data_class().select()} == {
|
||||
'bla first entry xxx',
|
||||
'bla second entry xxx',
|
||||
}
|
||||
|
||||
# async mode
|
||||
carddef.data_class().wipe()
|
||||
|
@ -857,6 +901,10 @@ def test_cards_import_json(pub, local_user, auth):
|
|||
# afterjobs are not async in tests: job is already completed during request
|
||||
assert carddef.data_class().count() == 2
|
||||
assert {x.data['0'] for x in carddef.data_class().select()} == {'first entry', 'second entry'}
|
||||
assert {x.digests['default'] for x in carddef.data_class().select()} == {
|
||||
'bla first entry xxx',
|
||||
'bla second entry xxx',
|
||||
}
|
||||
assert resp.json['err'] == 0
|
||||
assert 'job' in resp.json['data']
|
||||
job_id = resp.json['data']['job']['id']
|
||||
|
|
Loading…
Reference in New Issue