diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-07 19:38:19 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-07 19:38:19 -0700 |
commit | d01ca248a2216b34bc54eb3897f6c051782c1570 (patch) | |
tree | c981e9602f25eee49e504b3ca9bc4ff4356220b6 | |
parent | 8688a97077385f4ab7651a76d916c71efb6ecfe8 (diff) | |
download | fatcat-d01ca248a2216b34bc54eb3897f6c051782c1570.tar.gz fatcat-d01ca248a2216b34bc54eb3897f6c051782c1570.zip |
more basic web edit tests (files, GET)
-rw-r--r-- | python/tests/web_editing.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/python/tests/web_editing.py b/python/tests/web_editing.py index 473c81bc..ebe53b92 100644 --- a/python/tests/web_editing.py +++ b/python/tests/web_editing.py @@ -51,6 +51,13 @@ def test_web_release_create_merge(app_admin, api): assert b'Submitted' in rv.data assert b'None!' in rv.data + rv = app_admin.post('/editgroup/{}/unsubmit'.format(eg.editgroup_id), + follow_redirects=True, + ) + assert rv.status_code == 200 + rv = app_admin.get('/editgroup/{}'.format(eg.editgroup_id)) + assert rv.status_code == 200 + rv = app_admin.post('/editgroup/{}/annotation'.format(eg.editgroup_id), data={ 'comment_markdown': "This is an **example** of markdown in a test annotation", @@ -91,3 +98,43 @@ def test_web_container_create(app_admin, api): }, follow_redirects=True) assert rv.status_code == 200 + + +def test_web_file_create(app_admin, api): + + eg = quick_eg(api) + + # bogus/bad submit + rv = app_admin.post('/file/create', + data={ + 'editgroup_id': eg.editgroup_id, + }, + follow_redirects=True) + assert rv.status_code == 400 + + # ok/valid submit + rv = app_admin.post('/file/create', + data={ + 'editgroup_id': eg.editgroup_id, + 'size': '12345', + 'sha1': '45be56a396c4d03faaa41e055170c23534dec736', + }, + follow_redirects=True) + assert rv.status_code == 200 + + +def test_web_edit_get(app_admin): + + # these are all existing entities + rv = app_admin.get('/release/aaaaaaaaaaaaarceaaaaaaaaai/edit') + assert rv.status_code == 200 + assert b'A bigger example' in rv.data + + rv = app_admin.get('/file/aaaaaaaaaaaaamztaaaaaaaaam/edit') + assert rv.status_code == 200 + assert b'ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362' in rv.data + + rv = app_admin.get('/container/aaaaaaaaaaaaaeiraaaaaaaaam/edit') + assert rv.status_code == 200 + assert b'1549-1277' in rv.data + |