From 52ec366be4915dc9193a358ee9afebbadc238f4b Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 21 May 2020 09:58:50 +1000 Subject: [PATCH] Test more attributes (#1526) To increase coverage, sprinkle in some asserts for attributes that were not checked -- this uncovered a bug in Issue that two attributes were not properly initialized to NotSet. --- github/Issue.py | 2 ++ tests/Issue.py | 2 ++ tests/RepositoryKey.py | 1 + 3 files changed, 5 insertions(+) diff --git a/github/Issue.py b/github/Issue.py index a800da3b..5fdff351 100644 --- a/github/Issue.py +++ b/github/Issue.py @@ -612,6 +612,7 @@ class Issue(github.GithubObject.CompletableGithubObject): return self.number def _initAttributes(self): + self._active_lock_reason = github.GithubObject.NotSet self._assignee = github.GithubObject.NotSet self._assignees = github.GithubObject.NotSet self._body = github.GithubObject.NotSet @@ -625,6 +626,7 @@ class Issue(github.GithubObject.CompletableGithubObject): self._id = github.GithubObject.NotSet self._labels = github.GithubObject.NotSet self._labels_url = github.GithubObject.NotSet + self._locked = github.GithubObject.NotSet self._milestone = github.GithubObject.NotSet self._number = github.GithubObject.NotSet self._pull_request = github.GithubObject.NotSet diff --git a/tests/Issue.py b/tests/Issue.py index 4457c349..c67164be 100644 --- a/tests/Issue.py +++ b/tests/Issue.py @@ -80,6 +80,8 @@ class Issue(Framework.TestCase): self.assertEqual( self.issue.url, "https://api.github.com/repos/jacquev6/PyGithub/issues/28" ) + self.assertFalse(self.issue.locked) + self.assertIsNone(self.issue.active_lock_reason) self.assertEqual(self.issue.user.login, "jacquev6") self.assertEqual(self.issue.repository.name, "PyGithub") self.assertEqual( diff --git a/tests/RepositoryKey.py b/tests/RepositoryKey.py index 0b6d8484..12a784fe 100644 --- a/tests/RepositoryKey.py +++ b/tests/RepositoryKey.py @@ -55,6 +55,7 @@ class RepositoryKey(Framework.TestCase): ) self.assertEqual(self.key.created_at, datetime.datetime(2017, 2, 22, 8, 16, 23)) self.assertTrue(self.key.verified) + self.assertTrue(self.key.read_only) self.assertEqual( repr(self.key), 'RepositoryKey(title="PyGithub Test Key", id=21870881)' )