-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise an 'ArtifactNotFound' exception when requesting a non-existent …
…artifact
- Loading branch information
Showing
4 changed files
with
75 additions
and
3 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
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
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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
|
||
from mozci.errors import ArtifactNotFound | ||
from mozci.task import Task | ||
from mozci.util.taskcluster import get_artifact_url | ||
|
||
|
||
@pytest.fixture | ||
def create_task(): | ||
id = 0 | ||
|
||
def inner(**kwargs): | ||
nonlocal id | ||
task = Task.create(id=id, **kwargs) | ||
id += 1 | ||
return task | ||
|
||
return inner | ||
|
||
|
||
def test_missing_artifacts(responses, create_task): | ||
artifact = "public/artifact.txt" | ||
task = create_task(label="foobar") | ||
|
||
# First we'll check the new deployment. | ||
responses.add( | ||
responses.GET, get_artifact_url(task.id, artifact), status=404, | ||
) | ||
|
||
# Then we'll check the old deployment. | ||
responses.add( | ||
responses.GET, | ||
get_artifact_url(task.id, artifact, old_deployment=True), | ||
status=404, | ||
) | ||
|
||
with pytest.raises(ArtifactNotFound): | ||
task.get_artifact(artifact) |