/ tests / PullRequest1682.py
PullRequest1682.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 PullRequest1682(Framework.TestCase):
27      def setUp(self):
28          super().setUp()
29          self.repo = self.g.get_repo("ReDASers/Phishing-Detection")
30  
31      def test_no_parameters(self):
32          runs = self.repo.get_workflow_runs()
33          self.assertEqual(313400760, runs[0].id)
34  
35      def test_object_parameters(self):
36          branch = self.repo.get_branch("adversary")
37          runs = self.repo.get_workflow_runs(branch=branch)
38          self.assertEqual(204764033, runs[0].id)
39          self.assertEqual(1, runs.totalCount)
40  
41          user = self.g.get_user("shahryarabaki")
42          runs = self.repo.get_workflow_runs(actor=user)
43          self.assertEqual(28372848, runs[0].id)
44  
45      def test_string_parameters(self):
46          runs = self.repo.get_workflow_runs(actor="xzhou29")
47          self.assertEqual(226142695, runs[0].id)
48  
49          runs = self.repo.get_workflow_runs(branch="API_Flatten")
50          self.assertEqual(287515889, runs[0].id)
51  
52          runs = self.repo.get_workflow_runs(event="pull_request")
53          self.assertEqual(298867254, runs[0].id)
54  
55          runs = self.repo.get_workflow_runs(status="failure")
56          self.assertEqual(292080359, runs[0].id)