Coverage for app/backend/src/tests/test_dummy_data.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.14.2, created at 2026-06-21 09:29 +0000

1from google.protobuf import empty_pb2 

2 

3from couchers.db import session_scope 

4from couchers.jobs.handlers import check_database_consistency 

5from couchers.resources import copy_resources_to_database 

6from dummy_data import add_dummy_data 

7 

8 

9def test_add_dummy_data(db, caplog, testconfig): 

10 # copy the real resources to the database: this way if the testing resources go out of date with the real ones 

11 # causing dummy data to fail, we'll catch it easily 

12 with session_scope() as session: 

13 copy_resources_to_database(session) 

14 

15 add_dummy_data() 

16 assert len(caplog.records) == 0 

17 

18 # dummy data must not leave the database in an inconsistent state (raises DatabaseInconsistencyError otherwise) 

19 check_database_consistency(empty_pb2.Empty())