8000 Remove create_download. Start test_create_tree · palfrey/github3.py@5c41874 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5c41874

Browse files
committed
Remove create_download. Start test_create_tree
1 parent da4eac2 commit 5c41874

File tree

2 files changed

+3
-50
lines changed

2 files changed

+3
-50
lines changed

github3/repos.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from json import dumps
1010
from base64 import b64decode
11-
from requests import post
1211
from collections import Callable
1312
from github3.events import Event
1413
from github3.issues import Issue, IssueEvent, Label, Milestone, issue_params
@@ -329,52 +328,6 @@ def create_commit(self, message, tree, parents, author={}, committer={}):
329328
json = self._json(self._post(url, data=dumps(data)), 201)
330329
return Commit(json, self) if json else None
331330

332-
@requires_auth
333-
def create_download(self, name, path, description='',
334-
content_type='text/plain'):
335-
"""Create a new download on this repository.
336-
337-
I do not require you provide the size in bytes because it can be
338-
determined by the operating system.
339-
340-
.. warning::
341-
342-
On 2012-03-11, GitHub will be deprecating the Downloads API. This
343-
method will no longer work.
344-
345-
:param str name: (required), name of the file as it will appear
346-
:param str path: (required), path to the file
347-
:param str description: (optional), description of the file
348-
:param str content_type: (optional), e.g. 'text/plain'
349-
:returns: :class:`Download <Download>` if successful, else None
350-
"""
351-
json = None
352-
if name and path:
353-
url = self._build_url('downloads', base_url=self._api)
354-
from os import stat
355-
info = stat(path)
356-
data = {'name': name, 'size': info.st_size,
357-
'description': description,
358-
'content_type': content_type}
359-
json = self._json(self._post(url, data=dumps(data)), 201)
360-
361-
if not json:
362-
return None
363-
364-
form = [('key', json.get('path')),
365-
('acl', json.get('acl')),
366-
('success_action_status', '201'),
367-
('Filename', json.get('name')),
368-
('AWSAccessKeyId', json.get('accesskeyid')),
369-
('Policy', json.get('policy')),
370-
('Signature', json.get('signature')),
371-
('Content-Type', json.get('mime_type'))]
372-
file = [('file', open(path, 'rb').read())]
373-
resp = post(json.get('s3_url'), data=form, files=file,
374-
headers={'Accept-Charset': 'utf-8'})
375-
376-
return Download(json, self) if self._boolean(resp, 201, 404) else None
377-
378331
@requires_auth
379332
def create_fork(self, organization=None):
380333
"""Create a fork of this repository.

tests/test_repos.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ def test_create_commit(self):
173173
expect(self.repo.create_commit(**data)).isinstance(github3.git.Commit)
174174
self.mock_assertions()
175175

176-
def test_create_download(self):
177-
pass
178-
179176
def test_create_fork(self):
180177
self.request.return_value = generate_response('repo', 202)
181178
self.conf = {'data': None}
@@ -350,3 +347,6 @@ def test_create_tag(self):
350347
None)).is_None()
351348
expect(self.repo.create_tag(**data)).isinstance(github3.git.Tag)
352349
self.mock_assertions()
350+
351+
def test_create_tree(self):
352+
pass

0 commit comments

Comments
 (0)
0