Commit 6adf532a authored by Alexander Pace's avatar Alexander Pace

update gw_id from the client code

also version numbers and tests.
parent 1d070bc5
Pipeline #158667 passed with stages
in 18 minutes and 23 seconds
%define name ligo-gracedb
%define version 2.7.0
%define unmangled_version 2.7.0
%define version 2.7.1
%define unmangled_version 2.7.1
%define release 1
Summary: Gravity Wave Candidate Event Database
......
......@@ -906,7 +906,7 @@ class GraceDb(GraceDBClient):
else:
yield superevent
def confirm_superevent_as_gw(self, superevent_id):
def confirm_superevent_as_gw(self, superevent_id, gw_id=None):
"""Upgrade a superevent's state to 'confirmed GW'.
All LIGO-Virgo users can perform this action on test superevents,
......@@ -916,6 +916,8 @@ class GraceDb(GraceDBClient):
Args:
superevent_id (str): GraceDB ID of the superevent to confirm as
as GW.
gw_id (str): Custom ID of confirmed GW. If not specified, GraceDB
uses default GWYYMMDDabc schema.
Returns:
:class:`requests.models.Response`
......@@ -932,7 +934,12 @@ class GraceDb(GraceDBClient):
"""
template = self.templates['superevent-confirm-as-gw-template']
uri = template.format(superevent_id=superevent_id)
return self.post(uri)
fields = {}
if gw_id:
fields.update({'gw_id': gw_id})
return self.post(uri, data=fields)
@event_or_superevent
def files(self, object_id, filename="", *args, **kwargs):
......
......@@ -424,7 +424,7 @@ def test_confirm_as_gw(safe_client):
post_call_args, post_call_kwargs = mock_post.call_args
assert len(post_call_args) == 1
assert post_call_kwargs == {}
assert len(post_call_kwargs) == 1
template_call_args, template_call_kwargs = mock_template.format.call_args
assert template_call_args == ()
......
......@@ -203,7 +203,7 @@ def test_confirm_as_gw(safe_client):
post_call_args, post_call_kwargs = mock_post.call_args
assert len(post_call_args) == 1
assert post_call_kwargs == {}
assert post_call_kwargs['data'] == {}
template_call_args, template_call_kwargs = mock_template.format.call_args
assert template_call_args == ()
......
__version__ = '2.7.0'
__version__ = '2.7.1'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment