Skip to content

Commit

Permalink
Merge pull request #273 from kjsanger/bug/include-controls
Browse files Browse the repository at this point in the history
Fix inclusion of controls (controls to be included)
  • Loading branch information
kjsanger authored Mar 5, 2024
2 parents 40323e0 + 4eac52b commit b84f85d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/npg_irods/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def update_secondary_metadata(
case Platform.ILLUMINA, AnalysisType.NUCLEIC_ACID_SEQUENCING:
log.info("Illumina", item=i, path=p)
updated = illumina.ensure_secondary_metadata_updated(
rods_item, mlwh_session, include_controls=False
rods_item, mlwh_session, include_controls=True
)
case Platform.PACBIO, AnalysisType.NUCLEIC_ACID_SEQUENCING:
log.info("PacBio", item=i, path=p)
Expand Down
26 changes: 26 additions & 0 deletions tests/illumina/test_metadata_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,32 @@ def test_multiple_study_permissions_mx(
)
assert obj.permissions() == new_permissions

@m.context("When the data are multiplexed")
@m.context("When the tag index is for a control")
@m.it("Manages permissions while respecting the include_controls option")
def test_updates_control_permissions_mx(
self, illumina_synthetic_irods, illumina_synthetic_mlwh
):
path = illumina_synthetic_irods / "12345/12345#888.cram"

obj = DataObject(path)
old_permissions = [AC("irods", perm=Permission.OWN, zone="testZone")]
new_permissions = [
AC("irods", perm=Permission.OWN, zone="testZone"),
AC("ss_888", perm=Permission.READ, zone="testZone"),
]

assert obj.permissions() == old_permissions
assert not ensure_secondary_metadata_updated(
obj, mlwh_session=illumina_synthetic_mlwh, include_controls=False
)
assert obj.permissions() == old_permissions

assert ensure_secondary_metadata_updated(
obj, mlwh_session=illumina_synthetic_mlwh, include_controls=True
)
assert obj.permissions() == new_permissions

@m.context("When data are not multiplexed")
@m.context("When data have had consent withdrawn")
@m.it("Does not restore access permissions")
Expand Down

0 comments on commit b84f85d

Please sign in to comment.