chore(tests): Changing the logic for an intermittent tag test (#31820)
This commit is contained in:
parent
822441e0bd
commit
1a43654207
|
|
@ -487,8 +487,19 @@ class TestTagApi(SupersetTestCase):
|
||||||
|
|
||||||
@pytest.mark.usefixtures("create_tags")
|
@pytest.mark.usefixtures("create_tags")
|
||||||
def test_delete_favorite_tag_not_found(self):
|
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)
|
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)
|
rv = self.client.delete(uri, follow_redirects=True)
|
||||||
|
|
||||||
assert rv.status_code == 404
|
assert rv.status_code == 404
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue