aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/multicloud
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2021-11-29 09:14:13 +0000
committeradheli.tavares <adheli.tavares@est.tech>2021-11-30 09:46:22 +0000
commiteada20b74d31fc1d07d29270c3b37d7d94ca9b2d (patch)
treeaa291c1bb1da7fcd95ec24d2e3fabe87ddc78478 /kubernetes/multicloud
parent8d304a4c6c6a1c0679c41aa6a51ad6fa60f7d391 (diff)
[POLICY] Add references to new policyadmin username
Adding a new username for PAP and API changes for the robot testcases. Issue-ID: POLICY-3815 Change-Id: Iccef19828a34be9c2ff28201ee27caad37d83504 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'kubernetes/multicloud')
0 files changed, 0 insertions, 0 deletions
light .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Copyright 2019 AT&T Intellectual Property. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json

from robot.api.deco import keyword
from deepdiff import DeepDiff


class JSONKeywords(object):
    """JSON is common resource for simple json helper keywords.
    """

    def __init__(self):
        super(JSONKeywords, self).__init__()

    @keyword
    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, str) or isinstance(left, unicode):
            left_json = json.loads(left)
        else:
            left_json = left
        if isinstance(right, str) or isinstance(right, unicode):
            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

    @keyword
    def make_list_into_dict(self, dict_list, key):
        """ Converts a list of dicts that contains a field that has a unique key into a dict of dicts """
        d = {}
        if isinstance(dict_list, list):
            for thisDict in dict_list:
                v = thisDict[key]
                d[v] = thisDict
        return d

    @keyword
    def find_element_in_array(self, searched_array, key, value):
        """ Takes in an array and a key value, it will return the items in the array that has a key and value that
        matches what you pass in """
        elements = []
        for item in searched_array:
            if key in item:
                if item[key] == value:
                    elements.append(item)
        return elements