This is an automated email from the ASF dual-hosted git repository.

jli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 1a43654207 chore(tests): Changing the logic for an intermittent tag 
test (#31820)
1a43654207 is described below

commit 1a4365420737f373942425a01cee1138170c492d
Author: Vitor Avila <[email protected]>
AuthorDate: Mon Jan 13 16:11:23 2025 -0300

    chore(tests): Changing the logic for an intermittent tag test (#31820)
---
 tests/integration_tests/tags/api_tests.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/integration_tests/tags/api_tests.py 
b/tests/integration_tests/tags/api_tests.py
index c9a718f60d..79022d2805 100644
--- a/tests/integration_tests/tags/api_tests.py
+++ b/tests/integration_tests/tags/api_tests.py
@@ -487,8 +487,19 @@ class TestTagApi(SupersetTestCase):
 
     @pytest.mark.usefixtures("create_tags")
     def test_delete_favorite_tag_not_found(self):
+        """
+        Tag API: Test trying to remove an unexisting tag from the list
+        of user favorites returns 404.
+        """
         self.login(ADMIN_USERNAME)
-        uri = "api/v1/tag/123/favorites/"  # noqa: F541
+
+        # Fetch all existing tag IDs
+        existing_ids = [tag_id for (tag_id,) in db.session.query(Tag.id).all()]
+
+        # Get an ID not in use
+        non_existent_id = max(existing_ids, default=0) + 1
+
+        uri = f"api/v1/tag/{non_existent_id}/favorites/"  # noqa: F541
         rv = self.client.delete(uri, follow_redirects=True)
 
         assert rv.status_code == 404

Reply via email to