Download.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 Peter Buckley <dx-pbuckley@users.noreply.github.com> # 9 # Copyright 2018 sfdye <tsfdye@gmail.com> # 10 # # 11 # This file is part of PyGithub. # 12 # http://pygithub.readthedocs.io/ # 13 # # 14 # PyGithub is free software: you can redistribute it and/or modify it under # 15 # the terms of the GNU Lesser General Public License as published by the Free # 16 # Software Foundation, either version 3 of the License, or (at your option) # 17 # any later version. # 18 # # 19 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # 20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # 21 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # 22 # details. # 23 # # 24 # You should have received a copy of the GNU Lesser General Public License # 25 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # 26 # # 27 ################################################################################ 28 29 from datetime import datetime, timezone 30 31 from . import Framework 32 33 34 class Download(Framework.TestCase): 35 def setUp(self): 36 super().setUp() 37 self.download = self.g.get_user().get_repo("PyGithub").get_download(242550) 38 39 def testAttributes(self): 40 self.assertEqual(self.download.accesskeyid, None) 41 self.assertEqual(self.download.acl, None) 42 self.assertEqual(self.download.bucket, None) 43 self.assertEqual(self.download.content_type, "text/plain") 44 self.assertEqual( 45 self.download.created_at, 46 datetime(2012, 5, 22, 18, 58, 32, tzinfo=timezone.utc), 47 ) 48 self.assertEqual(self.download.description, None) 49 self.assertEqual(self.download.download_count, 0) 50 self.assertEqual(self.download.expirationdate, None) 51 self.assertEqual( 52 self.download.html_url, 53 "https://github.com/downloads/jacquev6/PyGithub/Foobar.txt", 54 ) 55 self.assertEqual(self.download.id, 242550) 56 self.assertEqual(self.download.mime_type, None) 57 self.assertEqual(self.download.name, "Foobar.txt") 58 self.assertEqual(self.download.path, None) 59 self.assertEqual(self.download.policy, None) 60 self.assertEqual(self.download.prefix, None) 61 self.assertEqual(self.download.redirect, None) 62 self.assertEqual(self.download.s3_url, None) 63 self.assertEqual(self.download.signature, None) 64 self.assertEqual(self.download.size, 1024) 65 self.assertEqual( 66 self.download.url, 67 "https://api.github.com/repos/jacquev6/PyGithub/downloads/242550", 68 ) 69 self.assertEqual(repr(self.download), "Download(id=242550)") 70 71 def testDelete(self): 72 self.download.delete()