diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-30 20:35:32 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-31 12:13:06 -0700 |
commit | b7aed96075187af72b510c55e762d1e13c0a5306 (patch) | |
tree | a9a70216fe820278ef0e90d83fa92c079c9d876d /python/tests | |
parent | 29593e492b632c8884c31993230d258d646e3d8c (diff) | |
download | fatcat-b7aed96075187af72b510c55e762d1e13c0a5306.tar.gz fatcat-b7aed96075187af72b510c55e762d1e13c0a5306.zip |
implement webface entity deletion
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/web_editing.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/python/tests/web_editing.py b/python/tests/web_editing.py index ea244388..8386badb 100644 --- a/python/tests/web_editing.py +++ b/python/tests/web_editing.py @@ -129,6 +129,57 @@ def test_web_file_create(app_admin, api): follow_redirects=True) assert rv.status_code == 200 +def test_web_file_toml_create(app_admin, api): + + eg = quick_eg(api) + + # bogus/bad submit + rv = app_admin.post('/file/create/toml', + data={ + 'editgroup_id': eg.editgroup_id, + }, + follow_redirects=True) + assert rv.status_code == 400 + + # ok/valid submit + rv = app_admin.post('/file/create/toml', + data={ + 'editgroup_id': eg.editgroup_id, + 'toml': """ +size = 12345 +sha1 = "45be56a396c4d03faaa41e055170c23534dec736" + """, + }, + follow_redirects=True) + assert rv.status_code == 200 + + # upper-case SHA-1 + rv = app_admin.post('/file/create/toml', + data={ + 'editgroup_id': eg.editgroup_id, + 'toml': """ +size = 12345 +sha1 = "45BE56A396C4D03FAAA41E055170C23534DEC736" + """, + }, + follow_redirects=True) + assert rv.status_code == 400 + +def test_web_file_delete(app_admin, api): + + eg = quick_eg(api) + + rv = app_admin.get('/file/aaaaaaaaaaaaamztaaaaaaaaam/delete') + assert rv.status_code == 200 + + rv = app_admin.post('/file/aaaaaaaaaaaaamztaaaaaaaaam/delete', + data={ + 'editgroup_id': eg.editgroup_id, + }, + follow_redirects=True) + assert rv.status_code == 200 + # NOTE: did not *accept* the deletion edit + DUMMY_DEMO_ENTITIES = { 'container': 'aaaaaaaaaaaaaeiraaaaaaaaam', 'creator': 'aaaaaaaaaaaaaircaaaaaaaaaq', @@ -186,3 +237,9 @@ def test_web_create_get(app_admin): rv = app_admin.get(f'/{entity_type}/create/toml') assert rv.status_code == 200 + +def test_web_edit_delete(app_admin): + + for entity_type in DUMMY_DEMO_ENTITIES.keys(): + rv = app_admin.get(f'/{entity_type}/{DUMMY_DEMO_ENTITIES[entity_type]}/delete') + assert rv.status_code == 200 |