ferruzzi commented on code in PR #68367:
URL: https://github.com/apache/airflow/pull/68367#discussion_r3392374134


##########
airflow-core/tests/unit/assets/test_manager.py:
##########
@@ -503,6 +512,57 @@ def _make_asset_model(
     return model
 
 
+class TestAssetMetricsTeamName:
+    @pytest.mark.parametrize(
+        ("multi_team", "expect_team_tag"),
+        [
+            pytest.param("true", True, id="with_team"),
+            pytest.param("false", False, id="without_team"),
+        ],
+    )
+    @mock.patch("airflow._shared.observability.metrics.stats._get_backend")
+    def test_asset_updates_respects_team_name(
+        self, mock_get_backend, multi_team, expect_team_tag, session, 
dag_maker, testing_dag_bundle
+    ):
+        mock_stats = mock.MagicMock(spec=StatsLogger)
+        mock_get_backend.return_value = mock_stats
+
+        clear_db_teams()
+        clear_db_dag_bundles()
+
+        team = Team(name="team_a")
+        session.add(team)
+        session.flush()
+
+        bundle = DagBundleModel(name="bundle_a")
+        bundle.teams.append(team)
+        session.add(bundle)
+        session.flush()

Review Comment:
   It looks like this block gets repeated a lot in this file; I may move it 
into a fixture in a follow-up but wanted to keep this PR scoped tight so we can 
get it approved and in 3.3
   
   ```python
           clear_db_teams()
           clear_db_dag_bundles()
   
           team = Team(name="team_a")
           session.add(team)
           session.flush()
   
           bundle = DagBundleModel(name="bundle_a")
           bundle.teams.append(team)
           session.add(bundle)
           session.flush()
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to