Skip to content

Commit

Permalink
Method to retrieve container for sample
Browse files Browse the repository at this point in the history
Merge pull request #98 from DiamondLightSource/retrieve_container_for_sample_id
  • Loading branch information
Anthchirp committed Mar 30, 2020
2 parents a1f3c87 + 7346c1f commit c570dba
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ addons:
mariadb: 10.3

before_install:
- wget https://github.com/DiamondLightSource/ispyb-database/releases/download/v1.10.4/ispyb-database-1.10.4.tar.gz
- tar xvfz ispyb-database-1.10.4.tar.gz
- wget https://github.com/DiamondLightSource/ispyb-database/releases/download/v1.11.1/ispyb-database-1.11.1.tar.gz
- tar xvfz ispyb-database-1.11.1.tar.gz
- mysql_upgrade -u root
- mysql -u root -e "CREATE DATABASE ispybtest; SET GLOBAL log_bin_trust_function_creators=ON;"
- mysql -u root -D ispybtest < schema/tables.sql
Expand Down
6 changes: 6 additions & 0 deletions ispyb/sp/shipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ def retrieve_dewars_for_proposal_code_number(
procname="retrieve_dewars_for_proposal_code_number_v2",
args=(proposal_code, proposal_number, auth_login),
)

def retrieve_container_for_sample_id(self, sample_id, auth_login=None):
"""Get a single row result-set with the container info for the sample identified by sample_id"""
return self.get_connection().call_sp_retrieve(
procname="retrieve_container_for_sample_id", args=(sample_id, auth_login)
)
8 changes: 8 additions & 0 deletions tests/test_shipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ def test_retrieve_dewars(testdb):
assert len(rs) > 0
rs = testdb.shipping.retrieve_dewars_for_proposal_code_number("cm", 14451, "boaty")
assert len(rs) > 0


def test_retrieve_container_for_sample_id(testdb):
shipping = testdb.shipping
rs = shipping.retrieve_container_for_sample_id(374695, None)
assert len(rs) == 1
rs = shipping.retrieve_container_for_sample_id(374695, "boaty")
assert len(rs) == 1

0 comments on commit c570dba

Please sign in to comment.