Skip to content

Commit

Permalink
#150: Add invalid test for data updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Nov 24, 2020
1 parent fc7f3a1 commit 510943e
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions test/icat/test_standard_endpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from datagateway_api.common.exceptions import BadRequestError
from datagateway_api.src.main import api
from datagateway_api.src.main import app
from datagateway_api.src.resources.entities.entity_map import endpoints
Expand Down Expand Up @@ -155,9 +156,26 @@ def test_valid_boundary_update_data(

assert response_json == single_investigation_test_data

def test_invalid_update_data(self):
# Exclude an ID at in one of the data pieces
pass
def test_invalid_update_data(
self, flask_test_app, valid_credentials_header, single_investigation_test_data,
):
"""There should be an ID in the request body to know which entity to update"""

expected_doi = "Test Data Identifier"
expected_summary = "Test Summary"

update_data_json = {
"doi": expected_doi,
"summary": expected_summary,
}
single_investigation_test_data[0]["doi"] = expected_doi
single_investigation_test_data[0]["summary"] = expected_summary

test_response = flask_test_app.patch(
"/investigations", headers=valid_credentials_header, json=update_data_json,
)

assert test_response.status_code == 400

def test_valid_get_one_with_filters(
self, flask_test_app, valid_credentials_header, single_investigation_test_data,
Expand Down

0 comments on commit 510943e

Please sign in to comment.