mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
30 lines
808 B
Python
30 lines
808 B
Python
from urllib.parse import urljoin
|
|
|
|
from requests import Response
|
|
|
|
from dvc.repo.experiments.push import STUDIO_URL, _notify_studio
|
|
|
|
|
|
def test_notify_studio_for_exp_push(mocker):
|
|
valid_response = Response()
|
|
valid_response.status_code = 200
|
|
mock_post = mocker.patch("requests.Session.post", return_value=valid_response)
|
|
|
|
_notify_studio(
|
|
["ref1", "ref2", "ref3"],
|
|
"[email protected]:iterative/dvc.git",
|
|
"TOKEN",
|
|
)
|
|
|
|
assert mock_post.called
|
|
assert mock_post.call_args == mocker.call(
|
|
urljoin(STUDIO_URL, "/webhook/dvc"),
|
|
json={
|
|
"repo_url": "[email protected]:iterative/dvc.git",
|
|
"client": "dvc",
|
|
"refs": ["ref1", "ref2", "ref3"],
|
|
},
|
|
headers={"Authorization": "token TOKEN"},
|
|
timeout=5,
|
|
)
|