@@ -39,60 +39,60 @@ def test_get_parameters_missing_keys(self):
3939 self .assertIsNone (after_date )
4040
4141 @patch (
42- "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.get_feeds_with_missing_bounding_boxes_query"
43- )
44- def test_rebuild_missing_bounding_boxes_dry_run (self , mock_query ):
45- # Mock Gtfsdataset and Gtfsfeed objects
46- mock_dataset1 = MagicMock ()
47- mock_dataset1 .latest = True
48- mock_dataset1 .stable_id = "dataset1"
49- mock_dataset1 .hosted_url = "http://example.com/dataset1"
50- mock_feed1 = MagicMock ()
51- mock_feed1 .stable_id = "feed1"
52- mock_feed1 .gtfsdatasets = [mock_dataset1 ]
53-
54- mock_dataset2 = MagicMock ()
55- mock_dataset2 .latest = True
56- mock_dataset2 .stable_id = "dataset2"
57- mock_dataset2 .hosted_url = "http://example.com/dataset2"
58- mock_feed2 = MagicMock ()
59- mock_feed2 .stable_id = "feed2"
60- mock_feed2 .gtfsdatasets = [mock_dataset2 ]
61-
62- mock_query .return_value .filter .return_value = mock_query .return_value
63- mock_query .return_value .all .return_value = [mock_feed1 , mock_feed2 ]
64-
65- result = rebuild_missing_bounding_boxes (
66- dry_run = True , after_date = None , db_session = MagicMock ()
42+ "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.get_feeds_with_missing_bounding_boxes_query"
6743 )
68- self .assertIn ("Dry run" , result ["message" ])
69- self .assertEqual (result ["total_processed" ], 2 )
44+ def test_rebuild_missing_bounding_boxes_dry_run (self , mock_query ):
45+ # Mock Gtfsdataset and Gtfsfeed objects
46+ mock_dataset1 = MagicMock ()
47+ mock_dataset1 .latest = True
48+ mock_dataset1 .stable_id = "dataset1"
49+ mock_dataset1 .hosted_url = "http://example.com/dataset1"
50+ mock_feed1 = MagicMock ()
51+ mock_feed1 .stable_id = "feed1"
52+ mock_feed1 .gtfsdatasets = [mock_dataset1 ]
53+
54+ mock_dataset2 = MagicMock ()
55+ mock_dataset2 .latest = True
56+ mock_dataset2 .stable_id = "dataset2"
57+ mock_dataset2 .hosted_url = "http://example.com/dataset2"
58+ mock_feed2 = MagicMock ()
59+ mock_feed2 .stable_id = "feed2"
60+ mock_feed2 .gtfsdatasets = [mock_dataset2 ]
7061
71- @patch (
72- "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.publish_messages"
73- )
74- @patch (
75- "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.get_feeds_with_missing_bounding_boxes_query"
76- )
77- def test_rebuild_missing_bounding_boxes_publish (self , mock_query , mock_publish ):
78- # Mock Gtfsdataset and Gtfsfeed objects
79- mock_dataset = MagicMock ()
80- mock_dataset .latest = True
81- mock_dataset .stable_id = "dataset1"
82- mock_dataset .hosted_url = "http://example.com/dataset1"
83- mock_feed = MagicMock ()
84- mock_feed .stable_id = "feed1"
85- mock_feed .gtfsdatasets = [mock_dataset ]
86-
87- mock_query .return_value .filter .return_value = mock_query .return_value
88- mock_query .return_value .all .return_value = [mock_feed ]
89- mock_publish .return_value = None
90-
91- result = rebuild_missing_bounding_boxes (
92- dry_run = False , after_date = None , db_session = MagicMock ()
62+ mock_query .return_value .filter .return_value = mock_query .return_value
63+ mock_query .return_value .all .return_value = [mock_feed1 , mock_feed2 ]
64+
65+ result = rebuild_missing_bounding_boxes (
66+ dry_run = True , after_date = None , db_session = MagicMock ()
67+ )
68+ self .assertIn ("Dry run" , result ["message" ])
69+ self .assertEqual (result ["total_processed" ], 2 )
70+
71+ @patch (
72+ "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.publish_messages"
9373 )
94- self .assertIn ("Successfully published" , result ["message" ])
95- self .assertEqual (result ["total_processed" ], 1 )
74+ @patch (
75+ "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.get_feeds_with_missing_bounding_boxes_query"
76+ )
77+ def test_rebuild_missing_bounding_boxes_publish (self , mock_query , mock_publish ):
78+ # Mock Gtfsdataset and Gtfsfeed objects
79+ mock_dataset = MagicMock ()
80+ mock_dataset .latest = True
81+ mock_dataset .stable_id = "dataset1"
82+ mock_dataset .hosted_url = "http://example.com/dataset1"
83+ mock_feed = MagicMock ()
84+ mock_feed .stable_id = "feed1"
85+ mock_feed .gtfsdatasets = [mock_dataset ]
86+
87+ mock_query .return_value .filter .return_value = mock_query .return_value
88+ mock_query .return_value .all .return_value = [mock_feed ]
89+ mock_publish .return_value = None
90+
91+ result = rebuild_missing_bounding_boxes (
92+ dry_run = False , after_date = None , db_session = MagicMock ()
93+ )
94+ self .assertIn ("Successfully published" , result ["message" ])
95+ self .assertEqual (result ["total_processed" ], 1 )
9696
9797 @patch (
9898 "tasks.missing_bounding_boxes.rebuild_missing_bounding_boxes.get_feeds_with_missing_bounding_boxes_query"
0 commit comments