/ tests / SelfHostedActionsRunner.py
SelfHostedActionsRunner.py
 1  ############################ Copyrights and license ############################
 2  #                                                                              #
 3  # Copyright 2020 Victor Zeng <zacker150@hotmail.com>                           #
 4  #                                                                              #
 5  # This file is part of PyGithub.                                               #
 6  # http://pygithub.readthedocs.io/                                              #
 7  #                                                                              #
 8  # PyGithub is free software: you can redistribute it and/or modify it under    #
 9  # the terms of the GNU Lesser General Public License as published by the Free  #
10  # Software Foundation, either version 3 of the License, or (at your option)    #
11  # any later version.                                                           #
12  #                                                                              #
13  # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #
14  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #
15  # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
16  # details.                                                                     #
17  #                                                                              #
18  # You should have received a copy of the GNU Lesser General Public License     #
19  # along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #
20  #                                                                              #
21  ################################################################################
22  
23  from . import Framework
24  
25  
26  class SelfHostedActionsRunner(Framework.TestCase):
27      def setUp(self):
28          super().setUp()
29          self.user = self.g.get_user("ReDASers")
30          self.repo = self.user.get_repo("Phishing-Detection")
31  
32      def testAttributes(self):
33          runner = self.repo.get_self_hosted_runner(2217)
34          self.assertEqual(2217, runner.id)
35          self.assertEqual("linux", runner.os)
36          self.assertEqual("4306125c7c84", runner.name)
37          self.assertEqual("offline", runner.status)
38          self.assertFalse(runner.busy)
39          labels = runner.labels()
40          self.assertEqual(3, len(labels))
41          self.assertEqual("self-hosted", labels[0]["name"])
42          self.assertEqual("X64", labels[1]["name"])
43          self.assertEqual("Linux", labels[2]["name"])