diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-31 00:52:21 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-07-31 12:13:06 -0700 |
commit | 701062f94d2cebede755d4f2c43e516b698341b1 (patch) | |
tree | b347912948527303c910024f351f01b926e72871 /python | |
parent | b7aed96075187af72b510c55e762d1e13c0a5306 (diff) | |
download | fatcat-701062f94d2cebede755d4f2c43e516b698341b1.tar.gz fatcat-701062f94d2cebede755d4f2c43e516b698341b1.zip |
fix typo bug resulting in lost/bad ext_id web edits
Diffstat (limited to 'python')
-rw-r--r-- | python/fatcat_web/forms.py | 4 | ||||
-rw-r--r-- | python/tests/web_editing.py | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/python/fatcat_web/forms.py b/python/fatcat_web/forms.py index 13776d10..1bd932bb 100644 --- a/python/fatcat_web/forms.py +++ b/python/fatcat_web/forms.py @@ -152,11 +152,11 @@ class ReleaseEntityForm(EntityEditForm): a = None setattr(re, simple_attr, a) for extid_attr in RELEASE_EXTID_ATTRS: - a = getattr(self, simple_attr).data + a = getattr(self, extid_attr).data # special case blank strings if a == '': a = None - setattr(re.ext_ids, simple_attr, a) + setattr(re.ext_ids, extid_attr, a) # bunch of complexity here to preserve old contrib metadata (eg, # affiliation and extra) not included in current forms # TODO: this may be broken; either way needs tests diff --git a/python/tests/web_editing.py b/python/tests/web_editing.py index 8386badb..fb8b3f93 100644 --- a/python/tests/web_editing.py +++ b/python/tests/web_editing.py @@ -24,6 +24,18 @@ def test_web_release_create_accept(app_admin, api): #assert b'badmojo' in rv.data assert b'Not a valid choice' in rv.data + # bad wikidata QID + rv = app_admin.post('/release/create', + data={ + 'editgroup_id': eg.editgroup_id, + 'release_type': 'article-journal', + 'release_stage': 'published', + 'title': 'something bogus', + 'wikidata_qid': '884', + }, + follow_redirects=True) + assert rv.status_code == 400 + # ok/valid submit rv = app_admin.post('/release/create', data={ @@ -31,9 +43,11 @@ def test_web_release_create_accept(app_admin, api): 'release_type': 'article-journal', 'release_stage': 'published', 'title': 'something bogus', + 'doi': '10.1234/999999', }, follow_redirects=True) assert rv.status_code == 200 + assert b'10.1234/999999' in rv.data rv = app_admin.get('/editgroup/{}'.format(eg.editgroup_id)) assert rv.status_code == 200 |