@@ -44,6 +44,12 @@ def setUp(self):
4444 self .country1 = testdata .country (name = "Country 1" , code = "C1" )
4545 self .country2 = testdata .country (name = "Country 2" , code = "C2" )
4646
47+ # Mock to allow creating submissions without having to set up content databases
48+ self .ensure_db_exists_patcher = mock .patch (
49+ "contentcuration.utils.publish.ensure_versioned_database_exists"
50+ )
51+ self .ensure_db_exists_patcher .start ()
52+
4753 self .channel_with_submission1 = testdata .channel ()
4854 self .channel_with_submission1 .public = False
4955 self .channel_with_submission1 .version = 1
@@ -93,6 +99,10 @@ def setUp(self):
9399 self .existing_submission2 .countries .add (self .country1 )
94100 self .existing_submission2 .save ()
95101
102+ def tearDown (self ):
103+ self .ensure_db_exists_patcher .stop ()
104+ super ().tearDown ()
105+
96106 def test_create_submission__is_editor (self ):
97107 self .client .force_authenticate (user = self .editor_user )
98108 submission = self .new_submission_metadata
@@ -463,6 +473,19 @@ class AdminViewSetTestCase(StudioAPITestCase):
463473 def setUp (self ):
464474 super ().setUp ()
465475
476+ self .resolved_time = datetime .datetime (2023 , 10 , 1 , tzinfo = pytz .utc )
477+ self .datetime_patcher = mock .patch (
478+ "contentcuration.viewsets.community_library_submission.timezone.now" ,
479+ return_value = self .resolved_time ,
480+ )
481+ self .mock_datetime = self .datetime_patcher .start ()
482+
483+ # Mock to allow creating submissions without having to set up content databases
484+ self .ensure_db_exists_patcher = mock .patch (
485+ "contentcuration.utils.publish.ensure_versioned_database_exists"
486+ )
487+ self .ensure_db_exists_patcher .start ()
488+
466489 self .submission = testdata .community_library_submission ()
467490 self .submission .channel .version = 3
468491 self .submission .channel .save ()
@@ -504,15 +527,9 @@ def setUp(self):
504527 "internal_notes" : self .internal_notes ,
505528 }
506529
507- self .resolved_time = datetime .datetime (2023 , 10 , 1 , tzinfo = pytz .utc )
508- self .patcher = mock .patch (
509- "contentcuration.viewsets.community_library_submission.timezone.now" ,
510- return_value = self .resolved_time ,
511- )
512- self .mock_datetime = self .patcher .start ()
513-
514530 def tearDown (self ):
515- self .patcher .stop ()
531+ self .datetime_patcher .stop ()
532+ self .ensure_db_exists_patcher .stop ()
516533 super ().tearDown ()
517534
518535 def _manually_reject_submission (self ):
0 commit comments