def test_url_building(self): test = SonarAPIHandler(host='http://localhost', port=9001, base_path='/testing') self.assertEqual( "http://localhost:9001/testing{}".format(test.RESOURCES_ENDPOINT), test._get_url(test.RESOURCES_ENDPOINT)) test = SonarAPIHandler(host='http://localhost', port=9001) self.assertEqual( "http://localhost:9001{}".format(test.RESOURCES_ENDPOINT), test._get_url(test.RESOURCES_ENDPOINT)) test = SonarAPIHandler(host='http://localhost') self.assertEqual( "http://localhost:9000{}".format(test.RESOURCES_ENDPOINT), test._get_url(test.RESOURCES_ENDPOINT))
def setUp(self): self.sonar = SonarAPIHandler(user='******', password='******') username = str(uuid.uuid1()) self.test_user = self.sonar.create_user( username, 'qwerty', username, "{}@example.com".format(username) ).json().get('user')
def setUp(self): self.h = SonarAPIHandler(user='******', password='******')
from sonarqube_api import SonarAPIHandler h = SonarAPIHandler(host='http://10.1.3.33', port=9000, user='******', password='******') # gen = h.get_metrics() gen = h.get_metrics() print(gen.nex()) # while True: # print(gen.send(None))
def setUp(self): self.sonar = SonarAPIHandler(user='******', password='******') self.test_user = str(uuid.uuid1())
import requests from sonarqube_api import SonarAPIHandler from flask import Flask, request from flask_restful import Resource, Api from flask_cors import CORS, cross_origin app = Flask(__name__) CORS(app) api = Api(app) #create an object to call all the api functionalities by providing valid #user name and password ref = SonarAPIHandler(user='******', password='******', host='http://10.26.32.107') #make http-get call to get components('name of the projects','key of the projects', etc.) of all the projects. comp = ref._make_call(method='get', endpoint='/api/projects/index') ex_comp = comp.json() #get all projects listed class get_project_list(Resource): def get(self): extract_json = comp.json() project = [] co = 1 for p in extract_json: dict = {} dict["Project_Name_" + str(co)] = p['nm'] co = co + 1