Beispiel #1
0
    def test_delete_graph(self):
        """Test delete_graph method

        Insert 2 datasets, and test delete_graph on one. Also test if
        start point return only one datasets
        """

        # empty tps
        self.tps.clean_up()

        # load a test
        timestamp_people = self.tps.load_people(
        )  # need the timestamp of people to delete it
        timestamp_instruments = self.tps.load_instruments()

        # Delete only the people graph
        self.request.json_body = {
            'named_graph':
            ['urn:sparql:test_askomics:jdoe:people_tsv_' + timestamp_people]
        }

        data = self.askview.delete_graph()

        assert data is None

        # test if start point return only one entity
        askview2 = AskView(self.request)
        askview2.settings = self.settings
        data = askview2.start_points()

        assert len(data["nodes"]) == 1

        # test if startpoint return only instruments
        expected_result = {
            'nodes': {
                self.settings['askomics.prefix'] + 'Instruments': {
                    'public': False,
                    'label': 'Instruments',
                    'uri': self.settings['askomics.prefix'] + 'Instruments',
                    'private': True,
                    'g': 'urn:sparql:test_askomics:jdoe:instruments_tsv_' +
                    timestamp_instruments,
                    'endpoint': 'http://localhost:8890/sparql'
                }
            },
            'galaxy': False
        }

        assert data == expected_result
Beispiel #2
0
    def test_delete_graph(self):
        """Test delete_graph method

        Insert 2 datasets, and test delete_graph on one. Also test if
        start point return only one datasets
        """

        # empty tps
        self.tps.clean_up()

        # load a test
        timestamp_people = self.tps.load_people() # need the timestamp of people to delete it
        timestamp_instruments = self.tps.load_instruments()

        # Delete only the people graph
        self.request.json_body = {
            'named_graph': ['urn:sparql:test_askomics:jdoe:people_tsv_' + timestamp_people]
        }

        data = self.askview.delete_graph()

        assert data is None

        # test if start point return only one entity
        askview2 = AskView(self.request)
        askview2.settings = self.settings
        data = askview2.start_points()

        assert len(data["nodes"]) == 1

        # test if startpoint return only instruments
        expected_result = {
            'nodes': {
                self.settings['askomics.prefix']+'Instruments':
                {
                    'public': False,
                    'label': 'Instruments',
                    'uri':
                    self.settings['askomics.prefix']+'Instruments',
                    'private': True,
                    'g':
                    'urn:sparql:test_askomics:jdoe:instruments_tsv_' + timestamp_instruments,
                    'endpoint': 'http://localhost:8890/sparql'
                }
            }
        }

        assert data == expected_result
Beispiel #3
0
    def test_delete_graph(self):
        """Test delete_graph method

        Insert 2 datasets, and test delete_graph on one. Also test if
        start point return only one datasets
        """

        # empty tps
        self.tps.clean_up()

        # load a test
        timestamp_people = self.tps.load_people() # need the timestamp of people to delete it
        timestamp_instruments = self.tps.load_instruments()

        # Delete only the people graph
        self.request.json_body = {
            'named_graph': ['urn:sparql:test_askomics:jdoe:people_tsv_' + timestamp_people]
        }

        data = self.askview.delete_graph()

        assert data is None

        # test if start point return only one entity
        askview2 = AskView(self.request)
        askview2.settings = self.settings
        data = askview2.start_points()

        assert len(data["nodes"]) == 1

        # test if startpoint return only instruments
        expected_result = {
            'nodes': {
                'http://www.semanticweb.org/irisa/ontologies/2016/1/igepp-ontology#Instruments':
                {
                    'public': False,
                    'label': 'Instruments',
                    'uri':
                    'http://www.semanticweb.org/irisa/ontologies/2016/1/igepp-ontology#Instruments',
                    'private': True,
                    'g':
                    'urn:sparql:test_askomics:jdoe:instruments_tsv_' + timestamp_instruments
                }
            }
        }

        assert data == expected_result
Beispiel #4
0
    def test_empty_database(self):
        """Test the empty_database method

        Insert data and test empty_database. Also test if
        start point return no results after deletion
        """

        # empty tps
        self.tps.clean_up()

        # load a test
        self.tps.load_people()
        self.tps.load_instruments()

        data = self.askview.empty_database()

        assert data == {} # if success, return an empty dict

        # test if start point return no data
        askview2 = AskView(self.request)
        askview2.settings = self.settings
        data = askview2.start_points()

        assert data == {'nodes': {}}
Beispiel #5
0
    def test_empty_database(self):
        """Test the empty_database method

        Insert data and test empty_database. Also test if
        start point return no results after deletion
        """

        # empty tps
        self.tps.clean_up()

        # load a test
        timestamp_people = self.tps.load_people()
        self.tps.load_instruments()

        data = self.askview.empty_database()

        assert data == {} # if success, return an empty dict

        # test if start point return no data
        askview2 = AskView(self.request)
        askview2.settings = self.settings
        data = askview2.start_points()

        assert data == {'nodes': {}}