mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
chore(tests): Changing the logic for an intermittent tag test (#31820)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user