Skip to content

Commit

Permalink
Change method name
Browse files Browse the repository at this point in the history
as requested. Also add test for GridInfoId.
  • Loading branch information
Anthchirp committed Oct 5, 2018
1 parent 62fc0a7 commit 4dd771b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ispyb/model/gridinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, dcgid, db_conn, preload=None):
def reload(self):
'''Load/update information from the database.'''
try:
self._data = self._db.mx_acquisition.get_dcg_grid(self._dcgid)[0]
self._data = self._db.mx_acquisition.retrieve_dcg_grid(self._dcgid)[0]
except ispyb.exception.ISPyBNoResultException:
self._data = None

Expand Down
2 changes: 1 addition & 1 deletion ispyb/sp/mxacquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def upsert_dcg_grid(self, values):
'''Insert or update the grid info associated with a data collection group'''
return self.get_connection().call_sp_write('upsert_dcg_grid', values)

def get_dcg_grid(self, dcgid):
def retrieve_dcg_grid(self, dcgid):
'''Retrieve a list of dictionaries containing the grid information for
one data collection group id. Raises ISPyBNoResultException if there
is no grid information available for the given DCGID.
Expand Down
5 changes: 3 additions & 2 deletions tests/test_mxacquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_mxacquisition_methods(testconfig):
iid = mxacquisition.upsert_image(list(params.values()))

with pytest.raises(ispyb.exception.ISPyBNoResultException):
gridinfo = mxacquisition.get_dcg_grid(dcgid)
gridinfo = mxacquisition.retrieve_dcg_grid(dcgid)

params = mxacquisition.get_dcg_grid_params()
params['parentid'] = dcgid
Expand All @@ -76,9 +76,10 @@ def test_mxacquisition_methods(testconfig):
dcg_grid_id = mxacquisition.upsert_dcg_grid(list(params.values()))
assert dcg_grid_id and dcg_grid_id > 0

gridinfo = mxacquisition.get_dcg_grid(dcgid)
gridinfo = mxacquisition.retrieve_dcg_grid(dcgid)
assert len(gridinfo) == 1
gridinfo = gridinfo[0]
assert gridinfo['gridInfoId'] == dcg_grid_id
assert gridinfo['dx_mm'] == params['dx_in_mm']
assert gridinfo['dy_mm'] == params['dy_in_mm']
assert gridinfo['meshAngle'] == params['mesh_angle']
Expand Down

0 comments on commit 4dd771b

Please sign in to comment.