def test_get_nodes_with_not_exist_name(self, name): """Test getting nodes with not exist name.""" with pytest.raises(NodeNotInGraphError) as exc_info: graph_processor = GraphProcessor(self._train_id, self._mock_data_manager) graph_processor.list_nodes(name) assert 'Can not find node in graph by the given node name' in exc_info.value.message
def test_get_nodes_success(self, name, result_file): """Test getting nodes successfully.""" graph_processor = GraphProcessor(self._train_id, self._mock_data_manager) results = graph_processor.list_nodes(name) expected_file_path = os.path.join(self.graph_results_dir, result_file) compare_result_with_file(results, expected_file_path)
def graph_nodes(): """ Interface to get graph nodes. Returns: Response, which contains a JSON object. """ name = request.args.get('name', default=None) tag = request.args.get("tag", default=None) train_id = get_train_id(request) graph_process = GraphProcessor(train_id, DATA_MANAGER, tag) response = graph_process.list_nodes(scope=name) return jsonify(response)