-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6652360
commit bcc7524
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -288,3 +288,27 @@ def test_view_url(self, mock_has_version, mock_gitrepo, repo_url, expected_url): | |
) | ||
view_url = bundle.view_url("0f0f0f") | ||
assert view_url == expected_url | ||
|
||
@mock.patch("airflow.dag_processing.bundles.git.Repo") | ||
def test_view_url_raises_if_no_version(self, mock_gitrepo): | ||
bundle = GitDagBundle( | ||
name="test", | ||
refresh_interval=300, | ||
repo_url="[email protected]:apache/airflow.git", | ||
tracking_ref="main", | ||
) | ||
with pytest.raises(AirflowException, match="Version is required to view the repository"): | ||
bundle.view_url(None) | ||
|
||
@mock.patch("airflow.dag_processing.bundles.git.Repo") | ||
@mock.patch.object(GitDagBundle, "_has_version") | ||
def test_view_url_raises_if_version_not_found(self, mock_has_version, mock_gitrepo): | ||
mock_has_version.return_value = False | ||
bundle = GitDagBundle( | ||
name="test", | ||
refresh_interval=300, | ||
repo_url="[email protected]:apache/airflow.git", | ||
tracking_ref="main", | ||
) | ||
with pytest.raises(AirflowException, match="Version not_found not found in the repository"): | ||
bundle.view_url("not_found") |