Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kgopal492 committed Feb 3, 2025
1 parent 650a4cf commit c852968
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/dependency-review.yml

This file was deleted.

9 changes: 2 additions & 7 deletions tests/integration_tests/tasks/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
],
ids=["Without trailing slash", "With trailing slash"],
)
@mock.patch("superset.tasks.cache.fetch_csrf_token")
@mock.patch("superset.tasks.cache.request.Request")
@mock.patch("superset.tasks.cache.request.urlopen")
def test_fetch_url(mock_urlopen, mock_request_cls, mock_fetch_csrf_token, base_url):
def test_fetch_url(mock_urlopen, mock_request_cls, base_url):
from superset.tasks.cache import fetch_url

mock_request = mock.MagicMock()
Expand All @@ -42,21 +41,17 @@ def test_fetch_url(mock_urlopen, mock_request_cls, mock_fetch_csrf_token, base_u
mock_urlopen.return_value.code = 200

initial_headers = {"Cookie": "cookie", "key": "value"}
csrf_headers = initial_headers | {"X-CSRF-Token": "csrf_token"}
mock_fetch_csrf_token.return_value = csrf_headers

app.config["WEBDRIVER_BASEURL"] = base_url
data = "data"
data_encoded = b"data"

result = fetch_url(data, initial_headers)

assert data == result["success"]
mock_fetch_csrf_token.assert_called_once_with(initial_headers)
mock_request_cls.assert_called_once_with(
"http://base-url/api/v1/chart/warm_up_cache",
data=data_encoded,
headers=csrf_headers,
headers=initial_headers,
method="PUT",
)
# assert the same Request object is used
Expand Down

0 comments on commit c852968

Please sign in to comment.