Skip to content

Commit 2b26491

Browse files
committed
Merge remote-tracking branch 'origin/devel' into log-refactor
2 parents 3206bf2 + 111159f commit 2b26491

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

src/RequestsLibrary/RequestsKeywords.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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')

src/RequestsLibrary/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '0.5.0'
1+
VERSION = '0.6.0'

tests/testcase.robot

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff 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-
207206
Post 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-
250248
Delete 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}

0 commit comments

Comments
 (0)