8000 Fix Python 3 test failures · CamDavidsonPilon/github3.py@3d9c2b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d9c2b2

Browse files
committed
Fix Python 3 test failures
1 parent 7a1b0ee commit 3d9c2b2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

tests/integration/test_repos_release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_download(self):
6969
_, filename = tempfile.mkstemp()
7070
asset.download(filename)
7171

72-
with open(filename) as fd:
72+
with open(filename, 'rb') as fd:
7373
assert len(fd.read(1024)) > 0
7474

7575
os.unlink(filename)

tests/unit/test_repos_release.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from .helper import UnitHelper
44

5+
import json
6+
57

68
def releases_url(path=''):
79
url = "https://api.github.com/repos/octocat/Hello-World/releases"
@@ -64,8 +66,10 @@ def test_edit_without_label(self):
6466

6567
def test_edit_with_label(self):
6668
self.instance.edit('new name', 'label')
67-
self.session.patch.assert_called_once_with(
68-
self.example_data['url'],
69-
data='{"name": "new name", "label": "label"}',
70-
headers={'Accept': 'application/vnd.github.manifold-preview'}
71-
)
69+
headers = {'Accept': 'application/vnd.github.manifold-preview'}
70+
_, args, kwargs = list(self.session.patch.mock_calls[0])
71+
assert self.example_data['url'] in args
72+
assert kwargs['headers'] == headers
73+
assert json.loads(kwargs['data']) == {
74+
'name': 'new name', 'label': 'label'
75+
}

0 commit comments

Comments
 (0)
0