Deployment.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2020 Steve Kowalik <steven@wedontsleep.org> # 4 # Copyright 2020 Pascal Hofmann <mail@pascalhofmann.de> # 5 # # 6 # This file is part of PyGithub. # 7 # http://pygithub.readthedocs.io/ # 8 # # 9 # PyGithub is free software: you can redistribute it and/or modify it under # 10 # the terms of the GNU Lesser General Public License as published by the Free # 11 # Software Foundation, either version 3 of the License, or (at your option) # 12 # any later version. # 13 # # 14 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 16 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 17 # details. # 18 # # 19 # You should have received a copy of the GNU Lesser General Public License # 20 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 21 # # 22 ################################################################################ 23 24 from datetime import datetime, timezone 25 26 from . import Framework 27 28 29 class Deployment(Framework.TestCase): 30 def setUp(self): 31 super().setUp() 32 self.deployment = self.g.get_user().get_repo("PyGithub").get_deployment(263877258) 33 34 def testAttributes(self): 35 self.assertEqual(self.deployment.id, 263877258) 36 self.assertEqual( 37 self.deployment.url, 38 "https://api.github.com/repos/jacquev6/PyGithub/deployments/263877258", 39 ) 40 self.assertEqual(self.deployment.ref, "743f5a58b0bce91c4eab744ff7e39dfca9e6e8a5") 41 self.assertEqual(self.deployment.sha, "743f5a58b0bce91c4eab744ff7e39dfca9e6e8a5") 42 self.assertEqual(self.deployment.task, "deploy") 43 self.assertEqual(self.deployment.payload, {"test": True}) 44 self.assertEqual(self.deployment.original_environment, "test") 45 self.assertEqual(self.deployment.environment, "test") 46 self.assertEqual(self.deployment.description, "Test deployment") 47 self.assertEqual(self.deployment.creator.login, "jacquev6") 48 created_at = datetime(2020, 8, 26, 11, 44, 53, tzinfo=timezone.utc) 49 self.assertEqual(self.deployment.created_at, created_at) 50 self.assertEqual(self.deployment.updated_at, created_at) 51 self.assertEqual(self.deployment.transient_environment, True) 52 self.assertEqual(self.deployment.production_environment, False) 53 self.assertEqual( 54 self.deployment.statuses_url, 55 "https://api.github.com/repos/jacquev6/PyGithub/deployments/263877258/statuses", 56 ) 57 self.assertEqual( 58 self.deployment.repository_url, 59 "https://api.github.com/repos/jacquev6/PyGithub", 60 ) 61 self.assertEqual( 62 repr(self.deployment), 63 'Deployment(url="https://api.github.com/repos/jacquev6/PyGithub/deployments/263877258", id=263877258)', 64 )