chore(tests): Remove ineffectual login (#27149)

This commit is contained in:
John Bodley
2024-04-09 09:52:02 -07:00
committed by GitHub
parent ae0f2ce3c1
commit 481a63da55
47 changed files with 857 additions and 802 deletions

View File

@@ -20,6 +20,7 @@ from unittest import mock
from superset.extensions import async_query_manager
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.constants import ADMIN_USERNAME
from tests.integration_tests.test_app import app
@@ -35,7 +36,7 @@ class TestAsyncEventApi(SupersetTestCase):
def test_events(self, mock_uuid4):
app._got_first_request = False
async_query_manager.init_app(app)
self.login(username="admin")
self.login(ADMIN_USERNAME)
with mock.patch.object(async_query_manager._redis, "xrange") as mock_xrange:
rv = self.fetch_events()
response = json.loads(rv.data.decode("utf-8"))
@@ -49,7 +50,7 @@ class TestAsyncEventApi(SupersetTestCase):
def test_events_last_id(self, mock_uuid4):
app._got_first_request = False
async_query_manager.init_app(app)
self.login(username="admin")
self.login(ADMIN_USERNAME)
with mock.patch.object(async_query_manager._redis, "xrange") as mock_xrange:
rv = self.fetch_events("1607471525180-0")
response = json.loads(rv.data.decode("utf-8"))
@@ -63,7 +64,7 @@ class TestAsyncEventApi(SupersetTestCase):
def test_events_results(self, mock_uuid4):
app._got_first_request = False
async_query_manager.init_app(app)
self.login(username="admin")
self.login(ADMIN_USERNAME)
with mock.patch.object(async_query_manager._redis, "xrange") as mock_xrange:
mock_xrange.return_value = [
(
@@ -116,7 +117,7 @@ class TestAsyncEventApi(SupersetTestCase):
assert rv.status_code == 401
def test_events_no_token(self):
self.login(username="admin")
self.login(ADMIN_USERNAME)
self.client.set_cookie(app.config["GLOBAL_ASYNC_QUERIES_JWT_COOKIE_NAME"], "")
rv = self.fetch_events()
assert rv.status_code == 401