Example #1
0
def get_credentials(workspace, key):
    credentials = ""

    json_creds = server._get(
        SERVER_URL + "/_api/v2/ws/%s/credential" % workspace)

    if len(json_creds["rows"]) > 0:

        for c in json_creds["rows"]:
            credentials += c["value"][key] + "\n"
        return credentials

    else:
        sys.exit("No credentials were found on faraday")
Example #2
0
def get_credentials(workspace, key):
    credentials = ""

    json_creds = server._get(
        SERVER_URL + "/_api/v2/ws/%s/credential" % workspace)

    if len(json_creds["rows"]) > 0:

        for c in json_creds["rows"]:
            credentials += c["value"][key] + "\n"
        return credentials

    else:
        sys.exit("No credentials were found on faraday")
Example #3
0
def show_table_services(workspace):

    services = []
    table = ""

    j_parsed = server._get(
        SERVER_URL + "/_api/v2/ws/%s/services/count?group_by=name" % workspace)

    if len(j_parsed["groups"]) > 0:

        table += "Number\tService\tCount\n"
        table += "------\t-------\t------\n"

        for l in j_parsed["groups"]:
            if l["name"] in SUPPORTED_SERVICES:
                services.append(l["name"])
                table += "[" + str(services.index(l["name"])) + "]\t"
                table += l["name"] + "\t" + str(l["count"]) + "\n"
        return table, services

    else:
        sys.exit("No services availables")
Example #4
0
def show_table_services(workspace):

    services = []
    table = ""

    j_parsed = server._get(
        SERVER_URL + "/_api/v2/ws/%s/services/count?group_by=name" % workspace)

    if len(j_parsed["groups"]) > 0:

        table += "Number\tService\tCount\n"
        table += "------\t-------\t------\n"

        for l in j_parsed["groups"]:
            if l["name"] in SUPPORTED_SERVICES:
                services.append(l["name"])
                table += "[" + str(services.index(l["name"])) + "]\t"
                table += l["name"] + "\t" + str(l["count"]) + "\n"
        return table, services

    else:
        sys.exit("No services availables")
Example #5
0
 def test_get(self):
     url = "http://get_url"
     responses.add(responses.GET, url, body='{"some": "object"}')
     expected_json = server._get(url)
     self.assertEqual(expected_json, {"some": "object"})
Example #6
0
 def test_get(self):
     url = "http://get_url"
     responses.add(responses.GET, url, body='{"some": "object"}')
     expected_json = server._get(url)
     self.assertEqual(expected_json, {"some": "object"})
Example #7
0
def total_credentials(workspace):
    json_creds = server._get(
        SERVER_URL + "/_api/v2/ws/%s/credential" % workspace)

    return len(json_creds["rows"])
Example #8
0
def total_credentials(workspace):
    json_creds = server._get(
        SERVER_URL + "/_api/v2/ws/%s/credential" % workspace)

    return len(json_creds["rows"])