/ tests / Markdown.py
Markdown.py
 1  ############################ Copyrights and license ############################
 2  #                                                                              #
 3  # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net>                 #
 4  # Copyright 2012 Zearin <zearin@gonk.net>                                      #
 5  # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net>                 #
 6  # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net>                 #
 7  # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #
 8  # Copyright 2018 sfdye <tsfdye@gmail.com>                                      #
 9  #                                                                              #
10  # This file is part of PyGithub.                                               #
11  # http://pygithub.readthedocs.io/                                              #
12  #                                                                              #
13  # PyGithub is free software: you can redistribute it and/or modify it under    #
14  # the terms of the GNU Lesser General Public License as published by the Free  #
15  # Software Foundation, either version 3 of the License, or (at your option)    #
16  # any later version.                                                           #
17  #                                                                              #
18  # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY  #
19  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    #
20  # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
21  # details.                                                                     #
22  #                                                                              #
23  # You should have received a copy of the GNU Lesser General Public License     #
24  # along with PyGithub. If not, see <http://www.gnu.org/licenses/>.             #
25  #                                                                              #
26  ################################################################################
27  
28  from . import Framework
29  
30  
31  class Markdown(Framework.TestCase):
32      def setUp(self):
33          super().setUp()
34          self.text = "MyTitle\n=======\n\nIssue #1"
35          self.repo = self.g.get_user().get_repo("PyGithub")
36  
37      def testRenderMarkdown(self):
38          self.assertEqual(
39              self.g.render_markdown(self.text),
40              '<h1><a name="mytitle" class="anchor" href="#mytitle"><span class="mini-icon mini-icon-link"></span></a>MyTitle</h1><p>Issue #1</p>',
41          )
42  
43      def testRenderGithubFlavoredMarkdown(self):
44          self.assertEqual(
45              self.g.render_markdown(self.text, self.repo),
46              '<h1>MyTitle</h1><p>Issue <a href="https://github.com/jacquev6/PyGithub/issues/1" class="issue-link" title="Gitub -&gt; Github everywhere">#1</a></p>',
47          )