Skip to content

Commit

Permalink
updating test for ticket 13018
Browse files Browse the repository at this point in the history
  • Loading branch information
atarkowska authored and joshmoore committed Oct 14, 2015
1 parent 46d63f0 commit 36647dc
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion components/tools/OmeroPy/test/integration/test_ishare.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,8 @@ def test8704(self):

def test13018(self):
"""
Test that share can't be activated when inactive
Test that image in share is unavailable when share
is inactive or expired
"""
owner = self.new_client()
member, mobj = self.new_client_and_user()
Expand All @@ -1007,6 +1008,30 @@ def test13018(self):
obj = omero.model.ShareI(sid, False)
member.sf.setSecurityContext(obj)

# test inactive share, if member has no access to the image
s = o_share.getShare(sid)
m_conn = self.new_client(session=s.uuid)
with pytest.raises(omero.SecurityViolation):
m_conn.sf.getQueryService().find("Image", image.id.val)
m_conn.__del__()

# activate again
o_share.setActive(sid, True)

# test expired share, if member has no access to the image
expiration = long(time.time() * 1000) + 86400
o_share.setExpiration(sid, rtime(expiration))
self.assert_expiration(expiration, o_share.getShare(sid))

m_conn = self.new_client(session=s.uuid)
# Forced closing
o_session = owner.sf.getSessionService()
o_session.closeSession(o_share.getShare(sid))

with pytest.raises(omero.SecurityViolation):
m_conn.sf.getQueryService().find("Image", image.id.val)
m_conn.__del__()

# Helpers

def assert_access(self, client, sid, success=True):
Expand Down

0 comments on commit 36647dc

Please sign in to comment.