Reaction.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2017 Nicolas AgustÃn Torres <nicolastrres@gmail.com> # 4 # Copyright 2018 sfdye <tsfdye@gmail.com> # 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 Reaction(Framework.TestCase): 30 def setUp(self): 31 super().setUp() 32 self.reactions = self.g.get_user("PyGithub").get_repo("PyGithub").get_issue(28).get_reactions() 33 34 def testAttributes(self): 35 self.assertEqual(self.reactions[0].content, "+1") 36 self.assertEqual( 37 self.reactions[0].created_at, 38 datetime(2017, 12, 5, 1, 59, 33, tzinfo=timezone.utc), 39 ) 40 self.assertEqual(self.reactions[0].id, 16916340) 41 self.assertEqual(self.reactions[0].user.login, "nicolastrres") 42 43 self.assertEqual( 44 self.reactions[0].__repr__(), 45 'Reaction(user=NamedUser(login="nicolastrres"), id=16916340)', 46 ) 47 48 def testDelete(self): 49 self.reactions[0].delete()