def rtcclient(mocker): mock_resp = mocker.MagicMock(spec=requests.Response) mock_resp.status_code = 200 mock_resp.headers = {"set-cookie": "cookie-id"} mocked_headers = mocker.patch("rtcclient.client.RTCClient._get_headers") mocked_headers.return_value = mock_resp return RTCClient(url="http://test.url:9443/jazz", username="******", password="******", searchpath=_search_path)
def configurarALM(): setup_basic_logging() url = "https://alm.serpro/ccm" login = read_flogin() global username global password username = login[0] password = login[1] global myclient global myquery myclient = RTCClient(url, username, password, ends_with_jazz=False) myquery = myclient.query
from rtcclient.client import RTCClient from rtcclient.utils import setup_basic_logging import os.path def ensure_path_exists(path): if not os.path.exists(path): os.mkdir(path) if __name__ == '__main__': arguments = docopt(__doc__, version='RTC Delta') if arguments["--logs"]: setup_basic_logging() rtc_client = RTCClient(arguments["--url"], arguments["--user"], arguments["--pass"], ends_with_jazz=arguments["--endsWithJazz"]) ensure_path_exists(arguments["--beforePath"]) ensure_path_exists(arguments["--afterPath"]) work_item = rtc_client.getWorkitem( arguments["--workitem"] ) # ,returned_properties="dc.ientifier,dc:title,rtc_cm:com.ibm.team.filesystem.workitems.change_set.com.ibm.team.scm.ChangeSet" print("%s : %s" % (work_item.identifier, work_item.title)) changesets = work_item.getChangeSets() for changeset in changesets: print("Traversing %s" % changeset) for change in changeset.getChanges(): print("Extracting before&after for change: %s" % change.comment) change.fetchBeforeStateFile(arguments["--beforePath"]) change.fetchAfterStateFile(arguments["--afterPath"])
)) workitem_list = [workitem] children_list = workitem.getChildren() if children_list: for child in children_list: workitem_list += get_workitem_list(child) return workitem_list if __name__ == '__main__': arguments = docopt(__doc__, version='RTC Delta') if arguments['--logs']: setup_basic_logging() else: logging.basicConfig(level=logging.CRITICAL) rtc_client = RTCClient(arguments['--url'], arguments['--user'], arguments['--pass'], ends_with_jazz=arguments['--endsWithJazz']) ensure_path_exists(arguments['--beforePath']) ensure_path_exists(arguments['--afterPath']) workitem = rtc_client.getWorkitem(arguments['--workitem']) if arguments['--children']: for child in get_workitem_list(workitem): get_changes(child) else: get_changes(workitem)
from rtcclient.client import RTCClient from rtcclient.utils import setup_basic_logging if __name__ == "__main__": # you can remove this if you don't need logging # default logging for console output setup_basic_logging() url = "https://your_domain:9443/jazz" username = "******" password = "******" projectarea_name = "your_projectarea_name" myclient = RTCClient(url, username, password) # query starts here myquery = myclient.query # customize your query string # below query string means: query all the workitems whose title # is "use case 1" myquerystr = 'dc:title="use case 1"' # specify the returned properties: title, id, state, owner # This is optional. All properties will be returned if not specified returned_prop = "dc:title,dc:identifier,rtc_cm:state,rtc_cm:ownedBy" queried_wis = myquery.queryWorkitems(query_str=myquerystr, projectarea_name=projectarea_name, returned_properties=returned_prop)
from rtcclient.client import RTCClient from rtcclient.utils import setup_basic_logging if __name__ == "__main__": # you can remove this if you don't need logging # default logging for console output setup_basic_logging() url = "https://your_domain:9443/jazz" username = "******" password = "******" myclient = RTCClient(url, username, password) # change workitem id here workitem_id = 123456 wk = myclient.getWorkitem(workitem_id) wk.addComment("changeme: add comments here")
from rtcclient.client import RTCClient from rtcclient.utils import setup_basic_logging if __name__ == "__main__": # you can remove this if you don't need logging # default logging for console output setup_basic_logging() url = "https://your_domain:9443/jazz" username = "******" password = "******" myclient = RTCClient(url, username, password) # get all workitems # If both projectarea_id and projectarea_name are None, all the workitems # in all ProjectAreas will be returned workitems_list = myclient.getWorkitems(projectarea_id=None, projectarea_name=None) # get a workitem with its id workitem_id = 123456 wk = myclient.getWorkitem(workitem_id)