Acknowledge lack of test coverage in the old Download API

This commit is contained in:
Vincent Jacques
2013-11-10 15:57:08 -08:00
parent 22f366b540
commit 5692c1ebb2
2 changed files with 15 additions and 13 deletions
+11 -11
View File
@@ -226,11 +226,11 @@ class Download(github.GithubObject.CompletableGithubObject):
def _useAttributes(self, attributes):
if "accesskeyid" in attributes: # pragma no branch
self._accesskeyid = self._makeStringAttribute(attributes["accesskeyid"])
self._accesskeyid = self._makeStringAttribute(attributes["accesskeyid"]) # pragma no cover (was covered only by create_download, which has been removed)
if "acl" in attributes: # pragma no branch
self._acl = self._makeStringAttribute(attributes["acl"])
self._acl = self._makeStringAttribute(attributes["acl"]) # pragma no cover (was covered only by create_download, which has been removed)
if "bucket" in attributes: # pragma no branch
self._bucket = self._makeStringAttribute(attributes["bucket"])
self._bucket = self._makeStringAttribute(attributes["bucket"]) # pragma no cover (was covered only by create_download, which has been removed)
if "content_type" in attributes: # pragma no branch
self._content_type = self._makeStringAttribute(attributes["content_type"])
if "created_at" in attributes: # pragma no branch
@@ -240,27 +240,27 @@ class Download(github.GithubObject.CompletableGithubObject):
if "download_count" in attributes: # pragma no branch
self._download_count = self._makeIntAttribute(attributes["download_count"])
if "expirationdate" in attributes: # pragma no branch
self._expirationdate = self._makeDatetimeAttribute(attributes["expirationdate"])
self._expirationdate = self._makeDatetimeAttribute(attributes["expirationdate"]) # pragma no cover (was covered only by create_download, which has been removed)
if "html_url" in attributes: # pragma no branch
self._html_url = self._makeStringAttribute(attributes["html_url"])
if "id" in attributes: # pragma no branch
self._id = self._makeIntAttribute(attributes["id"])
if "mime_type" in attributes: # pragma no branch
self._mime_type = self._makeStringAttribute(attributes["mime_type"])
self._mime_type = self._makeStringAttribute(attributes["mime_type"]) # pragma no cover (was covered only by create_download, which has been removed)
if "name" in attributes: # pragma no branch
self._name = self._makeStringAttribute(attributes["name"])
if "path" in attributes: # pragma no branch
self._path = self._makeStringAttribute(attributes["path"])
self._path = self._makeStringAttribute(attributes["path"]) # pragma no cover (was covered only by create_download, which has been removed)
if "policy" in attributes: # pragma no branch
self._policy = self._makeStringAttribute(attributes["policy"])
self._policy = self._makeStringAttribute(attributes["policy"]) # pragma no cover (was covered only by create_download, which has been removed)
if "prefix" in attributes: # pragma no branch
self._prefix = self._makeStringAttribute(attributes["prefix"])
self._prefix = self._makeStringAttribute(attributes["prefix"]) # pragma no cover (was covered only by create_download, which has been removed)
if "redirect" in attributes: # pragma no branch
self._redirect = self._makeBoolAttribute(attributes["redirect"])
self._redirect = self._makeBoolAttribute(attributes["redirect"]) # pragma no cover (was covered only by create_download, which has been removed)
if "s3_url" in attributes: # pragma no branch
self._s3_url = self._makeStringAttribute(attributes["s3_url"])
self._s3_url = self._makeStringAttribute(attributes["s3_url"]) # pragma no cover (was covered only by create_download, which has been removed)
if "signature" in attributes: # pragma no branch
self._signature = self._makeStringAttribute(attributes["signature"])
self._signature = self._makeStringAttribute(attributes["signature"]) # pragma no cover (was covered only by create_download, which has been removed)
if "size" in attributes: # pragma no branch
self._size = self._makeIntAttribute(attributes["size"])
if "url" in attributes: # pragma no branch
+4 -2
View File
@@ -154,8 +154,10 @@ class GithubObject(object):
@staticmethod
def _makeDatetimeAttribute(value):
def parseDatetime(s):
if len(s) == 24:
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z")
if len(s) == 24: # pragma no branch (This branch was used only when creating a download)
# The Downloads API has been removed. I'm keeping this branch because I have no mean
# to check if it's really useless now.
return datetime.datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.000Z") # pragma no cover (This branch was used only when creating a download)
elif len(s) == 25:
return datetime.datetime.strptime(s[:19], "%Y-%m-%dT%H:%M:%S") + (1 if s[19] == '-' else -1) * datetime.timedelta(hours=int(s[20:22]), minutes=int(s[23:25]))
else: