/ tests / Issue54.py
Issue54.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 datetime import datetime, timezone
29  
30  from . import Framework
31  
32  
33  class Issue54(Framework.TestCase):
34      def setUp(self):
35          super().setUp()
36          self.repo = self.g.get_user().get_repo("TestRepo")
37  
38      def testConversion(self):
39          commit = self.repo.get_git_commit("73f320ae06cd565cf38faca34b6a482addfc721b")
40          self.assertEqual(
41              commit.message,
42              "Test commit created around Fri, 13 Jul 2012 18:43:21 GMT, that is vendredi 13 juillet 2012 20:43:21 GMT+2\n",
43          )
44          self.assertEqual(
45              commit.author.date,
46              datetime(2012, 7, 13, 18, 47, 10, tzinfo=timezone.utc),
47          )