Skip to content
Snippets Groups Projects
Commit ec0dcd04 authored by Leo P. Singer's avatar Leo P. Singer
Browse files

Update unit tests for behavioral changes in GraceDB server

parent 25e01fd7
No related branches found
No related tags found
1 merge request!10Update unit tests for behavioral changes in GraceDB server
Pipeline #682322 passed
......@@ -6,6 +6,8 @@ Changelog
- Update supported Python versions to 3.9 through 3.13.
- Update unit tests to reflect behavioral changes in the GraceDB server.
0.2.0 (2022-12-06)
------------------
......
......@@ -97,7 +97,7 @@ def events_create(client, coinc_xml_bytes):
def test_events_get(client, events_create):
event_id = events_create['graceid']
result = client.events[event_id].get()
assert events_create == {**result, 'warnings': []}
assert events_create['graceid'] == result['graceid']
def test_events_update(client, events_create, coinc_xml_bytes):
......@@ -111,7 +111,7 @@ def test_events_search(client, events_create):
event_id = events_create['graceid']
result = list(client.events.search(query=event_id))
assert len(result) == 1
assert events_create == {**result[0], 'warnings': []}
assert events_create['graceid'] == result[0]['graceid']
@pytest.fixture
......@@ -503,6 +503,9 @@ def test_superevents_pipeline_preferred_events(client,
superevent_id = superevents_create['superevent_id']
prefs = client.superevents[superevent_id].pipeline_preferred_events
assert prefs.get() == []
prefs.add(event_id)
assert prefs.get() == [event_id]
with pytest.raises(HTTPError) as exc_info:
......@@ -510,16 +513,12 @@ def test_superevents_pipeline_preferred_events(client,
assert exc_info.value.response.status_code == codes.BAD_REQUEST
assert exc_info.value.response.text == f'"Event {event_id} is already the gstlal pipeline-preferred event for {superevent_id}"'
with pytest.raises(HTTPError) as exc_info:
prefs.add(event_id_2)
assert exc_info.value.response.status_code == codes.BAD_REQUEST
assert exc_info.value.response.text == f'"Adding {event_id_2} as a pipeline-preferred event would remove {event_id} as the preferred event"'
prefs.add(event_id_2)
assert prefs.get() == [event_id_2]
with pytest.raises(HTTPError) as exc_info:
prefs.delete(event_id)
assert exc_info.value.response.status_code == codes.BAD_REQUEST
assert exc_info.value.response.text == f'"Event {event_id} can\'t be removed from superevent {superevent_id}\'s pipeline preferred list because it is the preferred event"'
prefs.delete(event_id_2)
assert prefs.get() == []
with pytest.raises(HTTPError) as exc_info:
prefs.delete(event_id_2)
prefs.delete(event_id)
assert exc_info.value.response.status_code == codes.NOT_FOUND
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment