Autolink.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2021 Marco Köpcke <hello@parakoopa.de> # 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 from tests import Framework 23 24 25 class Autolink(Framework.TestCase): 26 def setUp(self): 27 super().setUp() 28 # When recording test, be sure to create a autolink for yourself on 29 # Github and update it here. 30 links = [x for x in self.g.get_user("theCapypara").get_repo("PyGithub").get_autolinks() if x.id == 209614] 31 self.assertEqual(1, len(links), "There must be exactly one autolink with the ID 209614.") 32 self.link = links[0] 33 34 def testAttributes(self): 35 self.assertEqual(self.link.id, 209614) 36 self.assertEqual(self.link.key_prefix, "DUMMY-") 37 self.assertEqual(self.link.url_template, "https://github.com/PyGithub/PyGithub/issues/<num>") 38 self.assertEqual(self.link.is_alphanumeric, True)