-
Notifications
You must be signed in to change notification settings - Fork 49
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
c376983
commit 31f3cd0
Showing
5 changed files
with
90 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
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,23 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
|
||
from logging import getLogger | ||
from packit_service.worker.events import Event | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
class OpenScanHubTaskFinishEvent(Event): | ||
def __init__( | ||
self, | ||
task_id: int, | ||
issues_added_url: str, | ||
issues_fixed_url: str, | ||
scan_results_url: str, | ||
): | ||
super().__init__() | ||
|
||
self.task_id = task_id | ||
self.issues_added_url = issues_added_url | ||
self.issues_fixed_url = issues_fixed_url | ||
self.scan_results_url = scan_results_url |
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,8 @@ | ||
{ | ||
"added.js": "http://openscanhub.fedoraproject.org/task/15649/log/added.js?format=raw", | ||
"fixed.js": "http://openscanhub.fedoraproject.org/task/15649/log/fixed.js?format=raw", | ||
"scan-results.js": "http://openscanhub.fedoraproject.org/task/15649/log/gvisor-tap-vsock-0.7.5-1.20241007054606793155.pr405.23.g829aafd6/scan-results.js?format=raw", | ||
"task_id": 15649, | ||
"topic": "org.fedoraproject.prod.openscanhub.task.finish", | ||
"timestamp": 1728297198.032705 | ||
} |
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,34 @@ | ||
# Copyright Contributors to the Packit project. | ||
# SPDX-License-Identifier: MIT | ||
|
||
import json | ||
import pytest | ||
|
||
from packit_service.worker.events import OpenScanHubTaskFinishEvent | ||
from packit_service.worker.parser import Parser | ||
from tests.spellbook import DATA_DIR | ||
|
||
|
||
@pytest.fixture() | ||
def openscanhub_task_finish_event(): | ||
with open(DATA_DIR / "fedmsg" / "open_scan_hub_task_finish.json") as outfile: | ||
return json.load(outfile) | ||
|
||
|
||
def test_parse_openscanhub_task_finish(openscanhub_task_finish_event): | ||
event_object = Parser.parse_event(openscanhub_task_finish_event) | ||
|
||
assert isinstance(event_object, OpenScanHubTaskFinishEvent) | ||
assert event_object.task_id == 15649 | ||
assert ( | ||
event_object.issues_added_url | ||
== "http://openscanhub.fedoraproject.org/task/15649/log/added.js?format=raw" | ||
) | ||
assert ( | ||
event_object.issues_fixed_url | ||
== "http://openscanhub.fedoraproject.org/task/15649/log/fixed.js?format=raw" | ||
) | ||
assert event_object.scan_results_url == ( | ||
"http://openscanhub.fedoraproject.org/task/15649/log/gvisor-tap-vsock" | ||
"-0.7.5-1.20241007054606793155.pr405.23.g829aafd6/scan-results.js?format=raw" | ||
) |