Repository: PyGithub/PyGithub

Issue:
adding has_projects to repository
This PR just adds the repository attribute for has_projects.


Discussion:
@asagage Thanks for your PR. Looks good. I will merge if you could add some simple unit tests? You can refer to the guide [here](https://github.com/PyGithub/PyGithub/blob/master/CONTRIBUTING.md#automated-tests). Same for the other PR 😃
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.


Resolving patch:
diff --git a/github/Repository.py b/github/Repository.py
--- a/github/Repository.py
+++ b/github/Repository.py
@@ -29,7 +29,7 @@
 # Copyright 2016 Dustin Spicuzza <dustin@virtualroadside.com>                  #
 # Copyright 2016 Enix Yu <enix223@163.com>                                     #
 # Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #
-# Copyright 2016 Per Øyvind Karlsen <proyvind@moondrake.org>                  #
+# Copyright 2016 Per Øyvind Karlsen <proyvind@moondrake.org>                   #
 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #
 # Copyright 2016 Sylvus <Sylvus@users.noreply.github.com>                      #
 # Copyright 2016 fukatani <nannyakannya@gmail.com>                             #
@@ -41,7 +41,7 @@
 # Copyright 2017 Jannis Gebauer <ja.geb@me.com>                                #
 # Copyright 2017 Jason White <jasonwhite@users.noreply.github.com>             #
 # Copyright 2017 Jimmy Zelinskie <jimmy.zelinskie+git@gmail.com>               #
-# Copyright 2017 Nhomar Hernández [Vauxoo] <nhomar@vauxoo.com>                #
+# Copyright 2017 Nhomar Hernández [Vauxoo] <nhomar@vauxoo.com>                 #
 # Copyright 2017 Simon <spam@esemi.ru>                                         #
 # Copyright 2018 Andrew Smith <espadav8@gmail.com>                             #
 # Copyright 2018 Brian Torres-Gil <btorres-gil@paloaltonetworks.com>           #
@@ -52,6 +52,7 @@
 # Copyright 2018 Shinichi TAMURA <shnch.tmr@gmail.com>                         #
 # Copyright 2018 Wan Liuyang <tsfdye@gmail.com>                                #
 # Copyright 2018 sfdye <tsfdye@gmail.com>                                      #
+# Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com>           #
 #                                                                              #
 # This file is part of PyGithub.                                               #
 # http://pygithub.readthedocs.io/                                              #
@@ -126,6 +127,30 @@ class Repository(github.GithubObject.CompletableGithubObject):
     def __repr__(self):
         return self.get__repr__({"full_name": self._full_name.value})
 
+    @property
+    def allow_merge_commit(self):
+        """
+        :type: bool
+        """
+        self._completeIfNotSet(self._allow_merge_commit)
+        return self._allow_merge_commit.value
+
+    @property
+    def allow_rebase_merge(self):
+        """
+        :type: bool
+        """
+        self._completeIfNotSet(self._allow_rebase_merge)
+        return self._allow_rebase_merge.value
+
+    @property
+    def allow_squash_merge(self):
+        """
+        :type: bool
+        """
+        self._completeIfNotSet(self._allow_squash_merge)
+        return self._allow_squash_merge.value
+
     @property
     def archived(self):
         """
@@ -350,6 +375,14 @@ def has_issues(self):
         self._completeIfNotSet(self._has_issues)
         return self._has_issues.value
 
+    @property
+    def has_projects(self):
+        """
+        :type: bool
+        """
+        self._completeIfNotSet(self._has_projects)
+        return self._has_projects.value
+
     @property
     def has_wiki(self):
         """
@@ -2536,6 +2569,9 @@ def get_release_asset(self, id):
         return github.GitReleaseAsset.GitReleaseAsset(self._requester, resp_headers, data, completed=True)
 
     def _initAttributes(self):
+        self._allow_merge_commit = github.GithubObject.NotSet
+        self._allow_rebase_merge = github.GithubObject.NotSet
+        self._allow_squash_merge = github.GithubObject.NotSet
         self._archived = github.GithubObject.NotSet
         self._archive_url = github.GithubObject.NotSet
         self._assignees_url = github.GithubObject.NotSet
@@ -2564,6 +2600,7 @@ def _initAttributes(self):
         self._git_url = github.GithubObject.NotSet
         self._has_downloads = github.GithubObject.NotSet
         self._has_issues = github.GithubObject.NotSet
+        self._has_projects = github.GithubObject.NotSet
         self._has_wiki = github.GithubObject.NotSet
         self._homepage = github.GithubObject.NotSet
         self._hooks_url = github.GithubObject.NotSet
@@ -2612,6 +2649,12 @@ def _initAttributes(self):
         self._watchers_count = github.GithubObject.NotSet
 
     def _useAttributes(self, attributes):
+        if "allow_merge_commit" in attributes:  # pragma no branch
+            self._allow_merge_commit = self._makeBoolAttribute(attributes["allow_merge_commit"])
+        if "allow_rebase_merge" in attributes:  # pragma no branch
+            self._allow_rebase_merge = self._makeBoolAttribute(attributes["allow_rebase_merge"])
+        if "allow_squash_merge" in attributes:  # pragma no branch
+            self._allow_squash_merge = self._makeBoolAttribute(attributes["allow_squash_merge"])
         if "archived" in attributes:  # pragma no branch
             self._archived = self._makeBoolAttribute(attributes["archived"])
         if "archive_url" in attributes:  # pragma no branch
@@ -2668,6 +2711,8 @@ def _useAttributes(self, attributes):
             self._has_downloads = self._makeBoolAttribute(attributes["has_downloads"])
         if "has_issues" in attributes:  # pragma no branch
             self._has_issues = self._makeBoolAttribute(attributes["has_issues"])
+        if "has_projects" in attributes:  # pragma no branch
+            self._has_projects = self._makeBoolAttribute(attributes["has_projects"])
         if "has_wiki" in attributes:  # pragma no branch
             self._has_wiki = self._makeBoolAttribute(attributes["has_wiki"])
         if "homepage" in attributes:  # pragma no branch


Test patch:
diff --git a/github/tests/AuthenticatedUser.py b/github/tests/AuthenticatedUser.py
--- a/github/tests/AuthenticatedUser.py
+++ b/github/tests/AuthenticatedUser.py
@@ -8,9 +8,10 @@
 # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net>                 #
 # Copyright 2016 Jannis Gebauer <ja.geb@me.com>                                #
 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com>          #
-# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com>                     #
+# Copyright 2017 Balázs Rostás <rostas.balazs@gmail.com>                       #
 # Copyright 2017 Jannis Gebauer <ja.geb@me.com>                                #
 # Copyright 2018 sfdye <tsfdye@gmail.com>                                      #
+# Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com>           #
 #                                                                              #
 # This file is part of PyGithub.                                               #
 # http://pygithub.readthedocs.io/                                              #
@@ -140,7 +141,8 @@ def testCreateRepository(self):
 
     def testCreateRepositoryWithAllArguments(self):
         repo = self.user.create_repo(name="TestPyGithub", description="Repo created by PyGithub", homepage="http://foobar.com",
-                                     private=False, has_issues=False, has_wiki=False, has_downloads=False)
+                                     private=False, has_issues=False, has_projects=False, has_wiki=False, has_downloads=False,
+                                     allow_squash_merge=False, allow_merge_commit=False, allow_rebase_merge=True)
         self.assertEqual(repo.url, "https://api.github.com/repos/jacquev6/TestPyGithub")
 
     def testCreateRepositoryWithAutoInit(self):
diff --git a/github/tests/Framework.py b/github/tests/Framework.py
--- a/github/tests/Framework.py
+++ b/github/tests/Framework.py
@@ -13,6 +13,7 @@
 # Copyright 2017 Hugo <hugovk@users.noreply.github.com>                        #
 # Copyright 2017 Simon <spam@esemi.ru>                                         #
 # Copyright 2018 sfdye <tsfdye@gmail.com>                                      #
+# Copyright 2018 Jacopo Notarstefano <jacopo.notarstefano@gmail.com>           #
 #                                                                              #
 # This file is part of PyGithub.                                               #
 # http://pygithub.readthedocs.io/                                              #
@@ -115,7 +116,7 @@ def getresponse(self):
         output = res.read()
 
         self.__writeLine(str(status))
-        self.__writeLine(str(headers))
+        self.__writeLine(str(list(headers)))
         if atLeastPython3: # In Py3, return from "read" is bytes
             self.__writeLine(output)
         else:
diff --git a/github/tests/Organization.py b/github/tests/Organization.py
--- a/github/tests/Organization.py
+++ b/github/tests/Organization.py
@@ -198,7 +198,8 @@ def testCreateRepoWithMinimalArguments(self):
     def testCreateRepoWithAllArguments(self):
         team = self.org.get_team(141496)
         repo = self.org.create_repo(name="TestPyGithub2", description="Repo created by PyGithub", homepage="http://foobar.com",
-                                    private=False, has_issues=False, has_wiki=False, has_downloads=False, team_id=team.id)
+                                    private=False, has_issues=False, has_projects=False, has_wiki=False, has_downloads=False,
+                                    team_id=team.id, allow_squash_merge=False, allow_merge_commit=False, allow_rebase_merge=True)
         self.assertEqual(repo.url, "https://api.github.com/repos/BeaverSoftware/TestPyGithub2")
 
     def testCreateRepositoryWithAutoInit(self):
diff --git a/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt
--- a/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt
+++ b/github/tests/ReplayData/AuthenticatedUser.testCreateRepositoryWithAllArguments.txt
@@ -4,8 +4,8 @@ api.github.com
 None
 /user/repos
 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
-{"has_wiki": false, "name": "TestPyGithub", "has_downloads": false, "private": false, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub"}
+{"has_wiki": false, "name": "TestPyGithub", "has_downloads": false, "private": false, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub", "has_projects": false, "allow_squash_merge": false, "allow_merge_commit": false, "allow_rebase_merge": true}
 201
 [('status', '201 Created'), ('x-ratelimit-remaining', '4979'), ('content-length', '1111'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"1c6473a60481c33b28a926041f763fce"'), ('date', 'Sat, 26 May 2012 09:55:27 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/jacquev6/TestPyGithub')]
-{"clone_url":"https://github.com/jacquev6/TestPyGithub.git","has_downloads":false,"watchers":1,"git_url":"git://github.com/jacquev6/TestPyGithub.git","updated_at":"2012-05-26T09:55:27Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://foobar.com","url":"https://api.github.com/repos/jacquev6/TestPyGithub","has_wiki":false,"has_issues":false,"fork":false,"forks":1,"mirror_url":null,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/jacquev6/TestPyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"name":"TestPyGithub","language":null,"description":"Repo created by PyGithub","ssh_url":"git@github.com:jacquev6/TestPyGithub.git","pushed_at":"2012-05-26T09:55:27Z","created_at":"2012-05-26T09:55:27Z","id":4454027,"html_url":"https://github.com/jacquev6/TestPyGithub","full_name":"jacquev6/TestPyGithub"}
+{"clone_url":"https://github.com/jacquev6/TestPyGithub.git","has_downloads":false,"watchers":1,"git_url":"git://github.com/jacquev6/TestPyGithub.git","updated_at":"2012-05-26T09:55:27Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://foobar.com","url":"https://api.github.com/repos/jacquev6/TestPyGithub","has_wiki":false,"has_issues":false,"fork":false,"forks":1,"mirror_url":null,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/jacquev6/TestPyGithub","owner":{"url":"https://api.github.com/users/jacquev6","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","login":"jacquev6","id":327146,"avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"name":"TestPyGithub","language":null,"description":"Repo created by PyGithub","ssh_url":"git@github.com:jacquev6/TestPyGithub.git","pushed_at":"2012-05-26T09:55:27Z","created_at":"2012-05-26T09:55:27Z","id":4454027,"html_url":"https://github.com/jacquev6/TestPyGithub","full_name":"jacquev6/TestPyGithub", "has_projects": false, "allow_squash_merge": false, "allow_merge_commit": false, "allow_rebase_merge": true}
 
diff --git a/github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt b/github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt
--- a/github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt
+++ b/github/tests/ReplayData/Organization.testCreateRepoWithAllArguments.txt
@@ -15,8 +15,8 @@ api.github.com
 None
 /orgs/BeaverSoftware/repos
 {'Content-Type': 'application/json', 'Authorization': 'Basic login_and_password_removed', 'User-Agent': 'PyGithub/Python'}
-{"has_wiki": false, "name": "TestPyGithub2", "has_downloads": false, "private": false, "team_id": 141496, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub"}
+{"has_wiki": false, "name": "TestPyGithub2", "has_downloads": false, "private": false, "team_id": 141496, "has_issues": false, "homepage": "http://foobar.com", "description": "Repo created by PyGithub", "has_projects": false, "allow_squash_merge": false, "allow_merge_commit": false, "allow_rebase_merge": true}
 201
 [('status', '201 Created'), ('x-ratelimit-remaining', '4969'), ('content-length', '1501'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"feb513e01eaf8e89967068fe8ed44cc7"'), ('date', 'Sun, 27 May 2012 05:20:43 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/repos/BeaverSoftware/TestPyGithub2')]
-{"organization":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"clone_url":"https://github.com/BeaverSoftware/TestPyGithub2.git","has_downloads":false,"watchers":1,"updated_at":"2012-05-27T05:20:42Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://foobar.com","url":"https://api.github.com/repos/BeaverSoftware/TestPyGithub2","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":false,"forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/TestPyGithub2","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"name":"TestPyGithub2","language":null,"description":"Repo created by PyGithub","ssh_url":"git@github.com:BeaverSoftware/TestPyGithub2.git","pushed_at":"2012-05-27T05:20:42Z","created_at":"2012-05-27T05:20:42Z","id":4460019,"git_url":"git://github.com/BeaverSoftware/TestPyGithub2.git","html_url":"https://github.com/BeaverSoftware/TestPyGithub2","full_name":"BeaverSoftware/TestPyGithub2"}
+{"organization":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"clone_url":"https://github.com/BeaverSoftware/TestPyGithub2.git","has_downloads":false,"watchers":1,"updated_at":"2012-05-27T05:20:42Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"http://foobar.com","url":"https://api.github.com/repos/BeaverSoftware/TestPyGithub2","mirror_url":null,"has_wiki":false,"has_issues":false,"fork":false,"forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/TestPyGithub2","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","login":"BeaverSoftware","id":1424031},"name":"TestPyGithub2","language":null,"description":"Repo created by PyGithub","ssh_url":"git@github.com:BeaverSoftware/TestPyGithub2.git","pushed_at":"2012-05-27T05:20:42Z","created_at":"2012-05-27T05:20:42Z","id":4460019,"git_url":"git://github.com/BeaverSoftware/TestPyGithub2.git","html_url":"https://github.com/BeaverSoftware/TestPyGithub2","full_name":"BeaverSoftware/TestPyGithub2", "has_projects": false, "allow_squash_merge": false, "allow_merge_commit": false, "allow_rebase_merge": true}