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")
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")
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")
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")
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"})
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"})
def total_credentials(workspace): json_creds = server._get( SERVER_URL + "/_api/v2/ws/%s/credential" % workspace) return len(json_creds["rows"])
def total_credentials(workspace): json_creds = server._get( SERVER_URL + "/_api/v2/ws/%s/credential" % workspace) return len(json_creds["rows"])