File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed
Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -452,6 +452,17 @@ def create_client_cert_session(
452452 session .cert = tuple (client_certs )
453453 return session
454454
455+ def session_exists (self , alias ):
456+ """Return True if the session has been already created
457+
458+ ``alias`` that has been used to identify the Session object in the cache
459+ """
460+ try :
461+ self ._cache [alias ]
462+ return True
463+ except RuntimeError :
464+ return False
465+
455466 def delete_all_sessions (self ):
456467 """ Removes all the session objects """
457468 logger .info ('Delete All Sessions' )
Original file line number Diff line number Diff line change 1- VERSION = '0.5 .0'
1+ VERSION = '0.6 .0'
Original file line number Diff line number Diff line change @@ -203,7 +203,6 @@ Post With File
203203 Dictionary Should Contain Key ${file } one
204204 Dictionary Should Contain Key ${file } two
205205
206-
207206Post Request With File
208207 [Tags] post
209208 Create Session httpbin http://httpbin.org
@@ -246,7 +245,6 @@ Options Request
246245 Should Be Equal As Strings ${resp.status_code } 200
247246 Dictionary Should Contain Key ${resp.headers } allow
248247
249-
250248Delete Request With URL Params
251249 [Tags] delete
252250 Create Session httpbin http://httpbin.org
@@ -398,3 +396,14 @@ Set Pretty Print to non-Boolean value
398396 Should Contain ${output } "key_one": "true"
399397 Should Contain ${output } "key_two": "this is a test string"
400398 Should Not Contain ${output } {u'key_two': u'this is a test string', u'key_one': u'true'}
399+
400+ Create a session and make sure it exists
401+ [Tags] session
402+ Create Session jigsaw2 http://jigsaw.w3.org
403+ ${exists } = Session Exists jigsaw2
404+ Should Be True ${exists }
405+
406+ Verify a non existing session
407+ [Tags] session
408+ ${exists } = Session Exists non-existing-session
409+ Should Not Be True ${exists }
You can’t perform that action at this time.
0 commit comments