def test__bug_request_causes_lambda_error(self): params = ['only_with_issue_types', 'graph_A4J', 'Issue Person'] from osbot_jira.api.graph.GS_Graph import GS_Graph assert type(Lambda_Graph_Commands().filter(params=params)) == GS_Graph assert Lambda_Graph_Commands().filter( params=params, channel='ABC' ) is None # bug was here (when channel was provided, the GS_Graph object was being returned and it was failing to serialize
def test_expand(self): result = json.loads(Lambda_Graph_Commands().expand( params=['graph_K90', 1, 'is fact of'])) self.result = set(result) == { 'puml', 'edges', 'graph_name', 'graph_or_key', 'nodes', 'depth' }
def test_raw_data(self): params = ['graph_J2O', 'details'] self.team_id = None self.channel = None results = Lambda_Graph_Commands().raw_data(self.team_id, self.channel, params, None) Dev.pprint(results)
def test_filter(self): params = ['group_by_field', 'graph_8SX', 'Issue Type'] self.team_id = None self.channel = None self.result = Lambda_Graph_Commands().filter(self.team_id, self.channel, params, None)
def test_raw_data__issue_id(self): params = [ 'GSSP-111', 'details' ] # when an issue ID is passed we should get the value as the first node self.team_id = None self.channel = None results = Lambda_Graph_Commands().raw_data(params=params) assert results['nodes']['GSSP-111']['Creator'] == 'dinis.cruz'
def test_mindmap__for_issue(self): Dev.pprint(Lambda_Graph_Commands().mindmap(self.team_id, self.channel, params=['GSCS-14']))
def test_mindmap(self): Dev.pprint(Lambda_Graph_Commands().mindmap( self.team_id, self.channel, params=['graph_K90', '200', '500']))
def test_last_10(self): Lambda_Graph_Commands().last(None, None, [])
def test_expand__bad_link_type(self): Lambda_Graph_Commands().expand(self.channel, params=['graph_K90', 1, 'aaaa'])
def test_expand__using_jira_id(self): Lambda_Graph_Commands().expand( self.channel, params=['RISK-873', 1, 'is created by VULN,asd,asd'])
def test_expand__no_puml(self): graph = Lambda_Graph_Commands().expand( params=['graph_K90', 1, 'relates to,has RISK'], save_graph=False) assert len(graph.nodes) > 20
def __init__(self): self.lambda_graph = Lambda('osbot_jira.lambdas.graph') self.api_issues = API_Issues() self.gs_bot_jira = GS_Bot_Jira() self.graph_commands = Lambda_Graph_Commands() self.elk_to_slack = ELK_to_Slack()
def test_show_go_js(self): Lambda_Graph_Commands().show(self.team_id, self.channel, params=['graph_OJF', 'go_js'])
def test_show(self): #Lambda_Graph_Commands().show(self.team_id, self.channel, params=['']) #Lambda_Graph_Commands().show(self.team_id, self.channel, params=['asd']) Lambda_Graph_Commands().show(self.team_id, self.channel, params=['graph_OJF'])
def test_plantuml(self): params = ['sec-9696-down'] Lambda_Graph_Commands().plantuml(self.team_id, self.channel, params, None)
def test_view_only_one_param(self): params = ['sec-9696-down'] Lambda_Graph_Commands().view(None, self.channel, params, None)
def test_view_links(self): params = ['graph_81N', 'links'] Lambda_Graph_Commands().view(None, self.channel, params, None)
def test_gs_okrs(self): Lambda_Graph_Commands().gs_okrs(self.channel, [], None)
def test_show_plantuml(self): Lambda_Graph_Commands().show(self.team_id, self.channel, params=['graph_OJF', 'plantuml'])
def test_create(self): result = Lambda_Graph_Commands().create( self.team_id, self.channel, ['graph_K90', 1, 'relates to,has RISK'], None) Dev.pprint(result)
def test_epic(self): key = 'SEC-9696' #key = 'GSOS-181' Lambda_Graph_Commands().epic(self.team_id, self.channel, [key], None)
class Jp_Graph_Data: def __init__(self): self.lambda_graph = Lambda('osbot_jira.lambdas.graph') self.api_issues = API_Issues() self.gs_bot_jira = GS_Bot_Jira() self.graph_commands = Lambda_Graph_Commands() self.elk_to_slack = ELK_to_Slack() def lambda_invoke(self, params): result = self.lambda_graph.invoke({'params': params, 'data': {}}) return json_loads(result) def issue(self, issue_id): return self.api_issues.issue(issue_id) def issues(self, issue_id): return self.api_issues.issues(issue_id) def jira_links(self, source, depth=1): params = ['links', source, depth] return self.gs_bot_jira.cmd_links(params, save_graph=False) def jira_search(self, query): params = query.split(' ') query = self.elk_to_slack.get_search_query(params) return self.api_issues.search_using_lucene(query) def graph_expand(self, source, depth, link_types): params = [source, depth, link_types] return self.graph_commands.expand(params=params, save_graph=False) #data = json..invoke(params)) #nodes = data.get('nodes') #edges = data.get('edges') def draw_graph(self, graph): nodes = graph.nodes edges = graph.edges import networkx as nx import matplotlib.pyplot as plt size = 40 plt.figure(figsize=(size, size)) G = nx.DiGraph() for node in nodes: G.add_node(node) for edge in edges: G.add_edge(edge[0], edge[2], label=edge[1]) edge_labels = nx.get_edge_attributes(G, 'label') # pos = nx.spring_layout(G) # pos=nx.nx_pydot.graphviz_layout(G,prog='dot') pos = nx.nx_pydot.graphviz_layout(G) nx.draw_networkx_nodes(G, pos, node_shape='', node_size=100) nx.draw_networkx_labels(G, pos, font_size=16) nx.draw_networkx_edges(G, pos) nx.draw_networkx_edge_labels(G, pos=pos, edge_labels=edge_labels, font_size=10)