Coverage for tests/test_objects.py: 41%
32 statements
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-17 04:01 +0000
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-17 04:01 +0000
1import pytest
3from bbconf.exceptions import BEDFileNotFoundError, MissingThumbnailError
5from .conftest import SERVICE_UNAVAILABLE
6from .utils import BED_TEST_ID, ContextManagerDBTesting
9@pytest.mark.skipif(SERVICE_UNAVAILABLE, reason="Database is not available")
10class TestObjects:
11 def test_object_path(self, bbagent_obj):
12 with ContextManagerDBTesting(config=bbagent_obj.config, add_data=True):
13 result = bbagent_obj.objects.get_object_uri(
14 "bed", BED_TEST_ID, "bed_file", "http"
15 )
17 assert isinstance(result, str)
19 def test_object_path_error(self, bbagent_obj):
20 with ContextManagerDBTesting(config=bbagent_obj.config, add_data=True):
21 with pytest.raises(BEDFileNotFoundError):
22 bbagent_obj.objects.get_object_uri("bed", "not_f", "bed_file", "http")
24 def test_object_path_thumbnail(self, bbagent_obj):
25 with ContextManagerDBTesting(config=bbagent_obj.config, add_data=True):
26 result = bbagent_obj.objects.get_thumbnail_uri(
27 "bed", BED_TEST_ID, "chrombins", "http"
28 )
29 assert isinstance(result, str)
31 def test_object_path_thumbnail_error(self, bbagent_obj):
32 with ContextManagerDBTesting(config=bbagent_obj.config, add_data=True):
33 with pytest.raises(MissingThumbnailError):
34 bbagent_obj.objects.get_thumbnail_uri(
35 "bed", BED_TEST_ID, "bed_file", "http"
36 )
38 def test_object_metadata(self, bbagent_obj):
39 with ContextManagerDBTesting(config=bbagent_obj.config, add_data=True):
40 result = bbagent_obj.objects.get_drs_metadata(
41 "bed", BED_TEST_ID, "bed_file", "localhost"
42 )
43 assert result is not None
46@pytest.mark.skip("Used to visualize the schema")
47def test_create_schema_graph(bbagent_obj):
48 f = ContextManagerDBTesting(config=bbagent_obj.config, add_data=True)
49 f._add_data()
50 f._add_universe()
52 bbagent_obj.config.db_engine.create_schema_graph()