diff options
author | sv764t <sv764t@att.com> | 2018-10-25 01:42:52 -0400 |
---|---|---|
committer | vrvarma <vv8305@att.com> | 2018-11-01 19:46:14 -0400 |
commit | 8bf49988b7d6af5fdb48b5d2c1f830fbe318e83a (patch) | |
tree | 4f802e46be137517205641fed2cb151636d1e1c4 /tests/optf-cmso/cmso/attlibs | |
parent | 96028b74964d833bfb82322b8f5cc10d29b3da9b (diff) |
Change Management Schedule Optimization
Adding scripts and robot test suites for cmso as per CSIT procedure
Fixing the start up scripts to use docker
Removing .pyc files
Fix copyright headers for the shell scripts
Change-Id: I61492abd5d5060b5a773dec74320f2ecfc0fcbf5
Issue-ID: OPTFRA-382
Signed-off-by: sv764t <sv764t@att.com>
Signed-off-by: vrvarma <vv8305@att.com>
Diffstat (limited to 'tests/optf-cmso/cmso/attlibs')
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/CurlLibrary.py | 13 | ||||
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/HTTPUtils.py | 21 | ||||
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/JSONUtils.py | 37 | ||||
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/OSUtils.py | 14 | ||||
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/RequestsClientCert.py | 7 | ||||
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/StringTemplater.py | 8 | ||||
-rw-r--r-- | tests/optf-cmso/cmso/attlibs/UID.py | 8 |
7 files changed, 108 insertions, 0 deletions
diff --git a/tests/optf-cmso/cmso/attlibs/CurlLibrary.py b/tests/optf-cmso/cmso/attlibs/CurlLibrary.py new file mode 100644 index 00000000..44c62293 --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/CurlLibrary.py @@ -0,0 +1,13 @@ +from curl import Curl + +class CurlLibrary: + + + def get_zip(self, url, filename): + fp = open(filename, "wb") + c = Curl() + c.get(url, ) + c.set_option(c.WRITEDATA, fp) + c.perform() + c.close() + fp.close()
\ No newline at end of file diff --git a/tests/optf-cmso/cmso/attlibs/HTTPUtils.py b/tests/optf-cmso/cmso/attlibs/HTTPUtils.py new file mode 100644 index 00000000..f9d380c9 --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/HTTPUtils.py @@ -0,0 +1,21 @@ +import urllib +from selenium import webdriver +import base64 + +class HTTPUtils: + """HTTPUtils is common resource for simple http helper keywords.""" + + def url_encode_string(self, barestring): + """URL Encode String takes in a string and converts into 'percent-encoded' string""" + return urllib.quote_plus(barestring) + + def ff_profile(self): + fp =webdriver.FirefoxProfile() + fp.set_preference("dom.max_script_run_time",120) + fp.update_preferences() + return fp.path + + def b64_encode(self, instring): + "" + return base64.b64encode(instring) + diff --git a/tests/optf-cmso/cmso/attlibs/JSONUtils.py b/tests/optf-cmso/cmso/attlibs/JSONUtils.py new file mode 100644 index 00000000..5df1e5c7 --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/JSONUtils.py @@ -0,0 +1,37 @@ +import json + +from deepdiff import DeepDiff + +class JSONUtils: + """JSONUtils is common resource for simple json helper keywords.""" + + def json_equals(self, left, right): + """JSON Equals takes in two strings or json objects, converts them into json if needed and then compares them, returning if they are equal or not.""" + if isinstance(left, basestring): + left_json = json.loads(left); + else: + left_json = left; + if isinstance(right, basestring): + right_json = json.loads(right); + else: + right_json = right; + + ddiff = DeepDiff(left_json, right_json, ignore_order=True); + if ddiff == {}: + return True; + else: + return False; + + def json_escape(self, jsonObject): + jsonstr = json.dumps(jsonObject) + outstr = jsonstr.replace('"', '\\"').replace('\n', '\\n') + return outstr + + def make_list_into_dict(self, listOfDicts, key): + """ Converts a list of dicts that contains a field that has a unique key into a dict of dicts """ + d = {} + if isinstance(listOfDicts, list): + for thisDict in listOfDicts: + v = thisDict[key] + d[v] = thisDict + return d
\ No newline at end of file diff --git a/tests/optf-cmso/cmso/attlibs/OSUtils.py b/tests/optf-cmso/cmso/attlibs/OSUtils.py new file mode 100644 index 00000000..78968f03 --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/OSUtils.py @@ -0,0 +1,14 @@ +from sys import platform + +class OSUtils: + """ Utilities useful for constructing OpenStack HEAT requests """ + + def get_normalized_os(self): + os = platform + if platform == "linux" or platform == "linux2": + os = 'linux64' + elif platform == "darwin": + os = 'mac64' + elif platform == "win32": + os = platform + return os diff --git a/tests/optf-cmso/cmso/attlibs/RequestsClientCert.py b/tests/optf-cmso/cmso/attlibs/RequestsClientCert.py new file mode 100644 index 00000000..e1fd66ff --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/RequestsClientCert.py @@ -0,0 +1,7 @@ + +class RequestsClientCert: + """RequestsClientCert allows adding a client cert to the Requests Robot Library.""" + + def add_client_cert(self, session, cert): + """Add Client Cert takes in a requests session object and a string path to the cert""" + session.cert = cert
\ No newline at end of file diff --git a/tests/optf-cmso/cmso/attlibs/StringTemplater.py b/tests/optf-cmso/cmso/attlibs/StringTemplater.py new file mode 100644 index 00000000..680600fd --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/StringTemplater.py @@ -0,0 +1,8 @@ +from string import Template + +class StringTemplater: + """StringTemplater is common resource for templating with strings.""" + + def template_string(self, template, values): + """Template String takes in a string and its values and converts it using the string.Template class""" + return Template(template).substitute(values)
\ No newline at end of file diff --git a/tests/optf-cmso/cmso/attlibs/UID.py b/tests/optf-cmso/cmso/attlibs/UID.py new file mode 100644 index 00000000..43748096 --- /dev/null +++ b/tests/optf-cmso/cmso/attlibs/UID.py @@ -0,0 +1,8 @@ +import uuid + +class UID: + """UUID is a simple library that generates a uuid""" + + def generate_UUID(self): + """generate a uuid""" + return uuid.uuid4()
\ No newline at end of file |