Skip to content

Commit

Permalink
add tests and fix new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
jburel committed Apr 2, 2024
1 parent 29ea024 commit 4bdeffc
Showing 1 changed file with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def testConnectUsingClient(self, gatewaywrapper):
client = omero.client()
client.createSession(user, password)
with BlitzGateway(client_obj=client) as conn:
assert client.connect(), "Cannot be connected"
assert conn.connect(), "Should be connected"

def testConnectUsingClientNoSessionWithIdentity(self, gatewaywrapper):
gatewaywrapper.loginAsAdmin()
Expand All @@ -250,7 +250,7 @@ def testConnectUsingClientNoSessionWithIdentity(self, gatewaywrapper):
client = omero.client()
with BlitzGateway(client_obj=client) as conn:
conn.setIdentity(user, password)
assert client.connect(), "Cannot be connected"
assert conn.connect(), "Should be connected"

def testConnectUsingClientSessionWithoutIdentity(self, gatewaywrapper):
gatewaywrapper.loginAsAdmin()
Expand All @@ -264,7 +264,7 @@ def testConnectUsingClientSessionWithoutIdentity(self, gatewaywrapper):

client = omero.client()
with BlitzGateway(client_obj=client) as conn:
assert client.connect() == False
assert conn.connect() == False

def testSessionId(self, gatewaywrapper):
gatewaywrapper.loginAsAdmin()
Expand All @@ -281,3 +281,20 @@ def testSessionId(self, gatewaywrapper):
sid = client.getSessionId()
with BlitzGateway(client_obj=client) as conn:
assert sid == conn.getSession().getUuid().val


def testConnectWithSessionId(self, gatewaywrapper):
gatewaywrapper.loginAsAdmin()
username = "connect_withsession_test_user"
password = "foobar"
connect_test_user = dbhelpers.UserEntry(
username, password, firstname='User',
lastname='connect_withsession')
chmod_test_user.create(gatewaywrapper.gateway, dbhelpers.ROOT.passwd)
gatewaywrapper.doDisconnect()

client = omero.client()
client.createSession(user, password)
sid = client.getSessionId()
with BlitzGateway(client_obj=client) as conn:
assert conn.connect(sUuid=sid), "Should be connected"

0 comments on commit 4bdeffc

Please sign in to comment.