def test_search_single_node_with_not_exist_name(self):
        """Test searching single node with not exist name."""
        test_name = "not_exist_name"

        with pytest.raises(exceptions.NodeNotInGraphError):
            graph_processor = GraphProcessor(self._train_id, self._mock_data_manager)
            graph_processor.search_single_node(test_name)
    def test_search_single_node_success(self, name, result_file):
        """Test searching single node successfully."""

        graph_processor = GraphProcessor(self._train_id, self._mock_data_manager)
        results = graph_processor.search_single_node(name)
        expected_file_path = os.path.join(self.graph_results_dir, result_file)
        compare_result_with_file(results, expected_file_path)
    def test_search_single_node_success(self, load_graph_record, name,
                                        result_file):
        """Test searching single node successfully."""

        graph_processor = GraphProcessor(self._train_id,
                                         self._mock_data_manager)
        results = graph_processor.search_single_node(name)
        self.compare_result_with_file(results, result_file)
Example #4
0
def graph_search_single_node():
    """
    Interface to search single node.

    Returns:
         Response, which contains a JSON object.
    """
    name = request.args.get("name")
    tag = request.args.get("tag", default=None)
    train_id = get_train_id(request)

    graph_process = GraphProcessor(train_id, DATA_MANAGER, tag)
    resp = graph_process.search_single_node(name)
    return jsonify(resp)