10000 Add unit tests for Asset#delete · borgstrom/github3.py@b599328 · GitHub
[go: up one dir, main page]

Skip to content

Commit b599328

Browse files
committed
Add unit tests for Asset#delete
1 parent f6e57dd commit b599328

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

github3/repos/release.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ def upload_asset(self, content_type, name, asset):
154154

155155
class Asset(GitHubCore):
156156

157-
CUSTOM_HEADERS = {'Accept': 'application/vnd.github.manifold-preview'}
158-
159157
def _update_attributes(self, asset):
160158
self._api = asset.get('url')
161159
#: Content-Type provided when the asset was created
@@ -223,7 +221,7 @@ def delete(self):
223221
"""
224222
url = self._api
225223
return self._boolean(
226-
self._delete(url, headers=Asset.CUSTOM_HEADERS),
224+
self._delete(url, headers=Release.CUSTOM_HEADERS),
227225
204,
228226
404
229227
)

tests/unit/test_repos_release.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ class TestAsset(UnitHelper):
9191
"updated_at": "2013-02-27T19:35:32Z"
9292
}
9393

94+
def test_delete(self):
95+
"""Verify the request to delete an Asset."""
96+
self.instance.delete()
97+
98+
self.session.delete.assert_called_once_with(
99+
url_for('/assets/1'),
100+
headers=Release.CUSTOM_HEADERS
101+
)
102+
94103
@pytest.mark.xfail
95104
def test_download(self):
96105
"""Verify the request to download an Asset file."""

0 commit comments

Comments
 (0)
0