summaryrefslogtreecommitdiffstats
path: root/robotframework-onap/ONAPLibrary
diff options
context:
space:
mode:
Diffstat (limited to 'robotframework-onap/ONAPLibrary')
-rw-r--r--robotframework-onap/ONAPLibrary/HTTPKeywords.py18
-rw-r--r--robotframework-onap/ONAPLibrary/Utilities.py4
2 files changed, 21 insertions, 1 deletions
diff --git a/robotframework-onap/ONAPLibrary/HTTPKeywords.py b/robotframework-onap/ONAPLibrary/HTTPKeywords.py
new file mode 100644
index 0000000..40f9998
--- /dev/null
+++ b/robotframework-onap/ONAPLibrary/HTTPKeywords.py
@@ -0,0 +1,18 @@
+from six.moves import urllib
+from robot.api.deco import keyword
+
+
+class HTTPKeywords(object):
+ """HTTPKeywords is common resource for simple http helper keywords."""
+ def __init__(self):
+ super(HTTPKeywords, self).__init__()
+
+ @keyword
+ def url_encode_string(self, barestring):
+ """URL Encode String takes in a string and converts it into fully 'percent-encoded' string"""
+ return urllib.parse.quote(barestring)
+
+ @keyword
+ def url_parse(self, url):
+ """ Get pieces of the URL """
+ return urllib.parse.urlparse(url)
diff --git a/robotframework-onap/ONAPLibrary/Utilities.py b/robotframework-onap/ONAPLibrary/Utilities.py
index 9f1e0c0..8c1f355 100644
--- a/robotframework-onap/ONAPLibrary/Utilities.py
+++ b/robotframework-onap/ONAPLibrary/Utilities.py
@@ -16,6 +16,7 @@ from ONAPLibrary.robotlibcore import HybridCore
from ONAPLibrary.DNSKeywords import DNSKeywords
from ONAPLibrary.SocketKeywords import SocketKeywords
from ONAPLibrary.UUIDKeywords import UUIDKeywords
+from ONAPLibrary.HTTPKeywords import HTTPKeywords
class Utilities(HybridCore):
@@ -25,6 +26,7 @@ class Utilities(HybridCore):
self.keyword_implementors = [
DNSKeywords(),
SocketKeywords(),
- UUIDKeywords()
+ UUIDKeywords(),
+ HTTPKeywords()
]
HybridCore.__init__(self, self.keyword_implementors)