Skip to content

Commit

Permalink
#150: Add invalid update by ID test
Browse files Browse the repository at this point in the history
- Currently fails, request gets a 500, not a 400 despite the user input actually being the issue
  • Loading branch information
MRichards99 committed Nov 24, 2020
1 parent 6477491 commit 451e4d7
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test/icat/test_standard_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,23 @@ def test_valid_update_with_id(

assert response_json == single_investigation_test_data

def test_invalid_update_with_id(self):
pass
def test_invalid_update_with_id(
self, flask_test_app, valid_credentials_header, single_investigation_test_data,
):
"""This test will attempt to put `icatdb` into an invalid state"""

# DOI cannot be over 255 characters, which this string is
invalid_update_json = {
"doi": "__________________________________________________________________"
"_________________________________________________________________________"
"_________________________________________________________________________"
"_________________________________________________________________________",
}

test_response = flask_test_app.patch(
f"/investigations/{single_investigation_test_data[0]['id']}",
headers=valid_credentials_header,
json=invalid_update_json,
)

assert test_response.status_code == 400

0 comments on commit 451e4d7

Please sign in to comment.