From d01ca248a2216b34bc54eb3897f6c051782c1570 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 7 May 2019 19:38:19 -0700 Subject: more basic web edit tests (files, GET) --- python/tests/web_editing.py | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'python/tests') 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 + -- cgit v1.2.3