Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdddog committed Jun 21, 2023
1 parent 3ebdec2 commit b65c950
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions academic_observatory_workflows/tests/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,22 @@
import unittest
from unittest.mock import patch

import requests
from airflow import AirflowException

from academic_observatory_workflows.github import trigger_repository_dispatch


class TestGithub(unittest.TestCase):
@patch("academic_observatory_workflows.github.requests.post")
def test_trigger_repository_dispatch(self, mock_requests_post):
response = requests.Response()
response.status_code = 204
mock_requests_post.return_value = response

trigger_repository_dispatch(org="org", repo_name="my-repo", token="my-token", event_type="my-event-type")
mock_requests_post.called_once()

response.status_code = 401
with self.assertRaises(AirflowException):
trigger_repository_dispatch(org="org", repo_name="my-repo", token="my-token", event_type="my-event-type")

0 comments on commit b65c950

Please sign in to comment.