SND@LHC Software
Loading...
Searching...
No Matches
conditionsDatabase.tests.test_factory Namespace Reference

Functions

 supply_dbAPI ()
 
 test_create_mongo_api ()
 
 test_create_unknown_api ()
 

Detailed Description

 This module tests the factory. 

Function Documentation

◆ supply_dbAPI()

conditionsDatabase.tests.test_factory.supply_dbAPI ( )
This function creates an instance of the CDB API.
This can be used by other functions.

Definition at line 11 of file test_factory.py.

11def supply_dbAPI():
12 """
13 This function creates an instance of the CDB API.
14 This can be used by other functions.
15 """
16 factory = APIFactory()
17 db_api = factory.construct_DB_API()
18 return db_api
19
20@pytest.mark.smoke_test

◆ test_create_mongo_api()

conditionsDatabase.tests.test_factory.test_create_mongo_api ( )
This test checks if the factory can create an instance of the API for MongoDB.

Definition at line 21 of file test_factory.py.

21def test_create_mongo_api():
22 """
23 This test checks if the factory can create an instance of the API for MongoDB.
24 """
25 factory = APIFactory()
26 db_api = factory.construct_DB_API()
27 assert isinstance(db_api, MongoToCDBAPIAdapter)
28
29@pytest.mark.smoke_test

◆ test_create_unknown_api()

conditionsDatabase.tests.test_factory.test_create_unknown_api ( )
This function checks if the factory can raise a proper exception
if an unsupported database type is specified in the configuration file.

Definition at line 30 of file test_factory.py.

30def test_create_unknown_api():
31 """
32 This function checks if the factory can raise a proper exception
33 if an unsupported database type is specified in the configuration file.
34 """
35 factory = APIFactory()
36 home_dir = os.getenv('FAIRSHIP')
37
38 with pytest.raises(NotImplementedError):
39 assert factory.construct_DB_API(home_dir + "/conditionsDatabase/tests/test_config.yml")