Files
PyGithub/tests/Workflow.py
T
Steve Kowalik a1ed7c0e2d Add support for Workflows (#1496)
To start supporting GitHub Actions, add the first part of that,
Workflow, which encapsulates a workflow over the API, along with
two methods on Repository to query them.
2020-05-05 15:49:45 +10:00

59 lines
3.0 KiB
Python

# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2020 Steve Kowalik <steven@wedontsleep.org> #
# #
# This file is part of PyGithub. #
# http://pygithub.readthedocs.io/ #
# #
# PyGithub is free software: you can redistribute it and/or modify it under #
# the terms of the GNU Lesser General Public License as published by the Free #
# Software Foundation, either version 3 of the License, or (at your option) #
# any later version. #
# #
# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
# details. #
# #
# You should have received a copy of the GNU Lesser General Public License #
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
# #
################################################################################
import datetime
from . import Framework
class Workflow(Framework.TestCase):
def setUp(self):
super().setUp()
self.workflow = self.g.get_repo("PyGithub/PyGithub").get_workflow("check.yml")
def testAttributes(self):
self.assertEqual(
repr(self.workflow),
'Workflow(url="https://api.github.com/repos/PyGithub/PyGithub/actions/workflows/1026390", name="check")',
)
self.assertEqual(self.workflow.id, 1026390)
self.assertEqual(self.workflow.name, "check")
self.assertEqual(self.workflow.path, ".github/workflows/check.yml")
self.assertEqual(self.workflow.state, "active")
timestamp = datetime.datetime(2020, 4, 15, 0, 48, 32)
self.assertEqual(self.workflow.created_at, timestamp)
self.assertEqual(self.workflow.updated_at, timestamp)
self.assertEqual(
self.workflow.url,
"https://api.github.com/repos/PyGithub/PyGithub/actions/workflows/1026390",
)
self.assertEqual(
self.workflow.html_url,
"https://github.com/PyGithub/PyGithub/blob/master/.github/workflows/check.yml",
)
self.assertEqual(
self.workflow.badge_url,
"https://github.com/PyGithub/PyGithub/workflows/check/badge.svg",
)