provdbconnector.tests package¶
Subpackages¶
Submodules¶
provdbconnector.tests.examples module¶
-
provdbconnector.tests.examples.
attributes_dict_example
()[source]¶ Retuns a example dict with some different attributes
Returns: dict with attributes Return type: dict
-
provdbconnector.tests.examples.
base_connector_bundle_parameter_example
()[source]¶ This example returns a dict with example arguments for a db_adapter
Returns: dict {attributes, metadata} Return type: dict
-
provdbconnector.tests.examples.
base_connector_record_parameter_example
()[source]¶ Returns a dict with attributes and metadata for a simple node
:return:dict with attributes metadata :rtype: dict
-
provdbconnector.tests.examples.
base_connector_relation_parameter_example
()[source]¶ Returns a example with a start nodes (attributes, metadata) and also a relation dict with attributes metadata
Returns: dict Return type: dict
provdbconnector.tests.test_prov_db module¶
-
class
provdbconnector.tests.test_prov_db.
ProvDbTestTemplate
(*args, **kwargs)[source]¶ Bases:
unittest.case.TestCase
This abstract test class to test the high level function of you database adapter. To use this unitest Template extend from this class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
""" auth_info = {"invalid": "Invalid"} with self.assertRaises(InvalidOptionsException): self.instance.connect(auth_info) def clear_database(self): """ Clear the database """ self.instance.all_nodes = dict() self.instance.all_relations= dict() def tearDown(self): """ Delete your instance
-
setUp
()[source]¶ Use the setup method to create a provapi instance with you adapter
Warning
Override this function if you extend this test! Otherwise the test will fail.
Returns:
-
test_prov_primer_example
()[source]¶ This test try to save and restore a common prov example document
Returns:
-
test_primer_example_alternate
()[source]¶ This test try to save and restore a common prov example document. But in a more complex way
Returns:
-
test_w3c_publication_1
()[source]¶ This test try to save and restore a common prov example document.
Returns:
-
test_w3c_publication_2
()[source]¶ This test try to save and restore a common prov example document.
Returns:
-
test_bundles1
()[source]¶ This test try to save and restore a common prov example document. With a bundle and some connections inside the bundle. This example is also available via Provstore <https://provenance.ecs.soton.ac.uk/store/documents/114710/>
Returns:
-
test_bundles2
()[source]¶ This test try to save and restore a common prov example document. With a bundle and some connections inside the bundle. This example is also available via Provstore <https://provenance.ecs.soton.ac.uk/store/documents/114704/>
The main difference to the bundle_1 is that here we have also a mentionOf connection between bundles. See PROV-Links spec for more information
Returns:
-
test_collections
()[source]¶ This test try to save and restore a common prov example document.
Returns:
-
-
class
provdbconnector.tests.test_prov_db.
ProvDbTests
(methodName='runTest')[source]¶ Bases:
unittest.case.TestCase
This tests are only for the ProvDb itself. You don’t have to extend this test in case you want to write your own adapter
-
maxDiff
= None¶
-
test_save_document_from_prov_invalid_arguments
()[source]¶ Try to create a prov with some invalid arguments :return:
-
test_get_document_as_prov_invalid_arguments
()[source]¶ Try to get the prov document with invalid arguments
Returns:
-
test_save_bundle_invalid_arguments
()[source]¶ Try to create a bundle with invalid arguments :return:
-
test_get_element
()[source]¶ Try to save a single record without document_id and get the record back from the db
-
test_save_relation_with_unknown_nodes
()[source]¶ Test to create a relation were the start and end node dose not exist This should also work
-