CommitStatus.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 Jannis Gebauer <ja.geb@me.com> # 8 # Copyright 2016 Martijn Koster <mak-github@greenhills.co.uk> # 9 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> # 10 # Copyright 2017 Simon <spam@esemi.ru> # 11 # Copyright 2018 sfdye <tsfdye@gmail.com> # 12 # # 13 # This file is part of PyGithub. # 14 # http://pygithub.readthedocs.io/ # 15 # # 16 # PyGithub is free software: you can redistribute it and/or modify it under # 17 # the terms of the GNU Lesser General Public License as published by the Free # 18 # Software Foundation, either version 3 of the License, or (at your option) # 19 # any later version. # 20 # # 21 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 22 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 23 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 24 # details. # 25 # # 26 # You should have received a copy of the GNU Lesser General Public License # 27 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 28 # # 29 ################################################################################ 30 31 from datetime import datetime, timezone 32 33 from . import Framework 34 35 36 class CommitStatus(Framework.TestCase): 37 def setUp(self): 38 super().setUp() 39 self.statuses = list( 40 self.g.get_user().get_repo("PyGithub").get_commit("1292bf0e22c796e91cc3d6e24b544aece8c21f2a").get_statuses() 41 ) 42 43 def testAttributes(self): 44 self.assertEqual( 45 self.statuses[0].created_at, 46 datetime(2012, 9, 8, 11, 30, 56, tzinfo=timezone.utc), 47 ) 48 self.assertEqual( 49 self.statuses[0].updated_at, 50 datetime(2012, 9, 8, 11, 30, 56, tzinfo=timezone.utc), 51 ) 52 self.assertEqual(self.statuses[0].creator.login, "jacquev6") 53 self.assertEqual(self.statuses[0].description, "Status successfuly created by PyGithub") 54 self.assertEqual(self.statuses[1].description, None) 55 self.assertEqual(self.statuses[0].id, 277040) 56 self.assertEqual(self.statuses[0].state, "success") 57 self.assertEqual(self.statuses[1].state, "pending") 58 self.assertEqual(self.statuses[0].context, "build") 59 self.assertEqual( 60 self.statuses[0].target_url, 61 "https://github.com/jacquev6/PyGithub/issues/67", 62 ) 63 self.assertEqual(self.statuses[1].target_url, None) 64 self.assertEqual( 65 repr(self.statuses[0]), 66 'CommitStatus(state="success", id=277040, context="build")', 67 )