Allow GithubObject.update() to be passed headers (#1300)

SourceImport.update() is really GithubObject.update(), which just calls
GET on the object's URL. Refetching a source import requires an
additional header, so change GithubObject.update() to pass any it is
given, and add a test for SourceImport.update()

Fixes #1297
This commit is contained in:
Steve Kowalik
2019-11-26 14:29:24 +11:00
committed by GitHub
parent 3170cafce5
commit 989b635e33
4 changed files with 24 additions and 1 deletions
+5
View File
@@ -23,6 +23,7 @@
################################################################################
from __future__ import absolute_import
from github import Consts
import github.GithubObject
@@ -143,6 +144,10 @@ class SourceImport(github.GithubObject.CompletableGithubObject):
self._completeIfNotSet(self._vcs_url)
return self._vcs_url.value
def update(self):
import_header = {"Accept": Consts.mediaTypeImportPreview}
return super(SourceImport, self).update(additional_headers=import_header)
def _initAttributes(self):
self._authors_count = github.GithubObject.NotSet
self._authors_url = github.GithubObject.NotSet