aboutsummaryrefslogtreecommitdiff
path: root/Core/Scripts/ThirdParty/github/tests/Team.py
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Scripts/ThirdParty/github/tests/Team.py')
-rw-r--r--Core/Scripts/ThirdParty/github/tests/Team.py75
1 files changed, 75 insertions, 0 deletions
diff --git a/Core/Scripts/ThirdParty/github/tests/Team.py b/Core/Scripts/ThirdParty/github/tests/Team.py
new file mode 100644
index 0000000..d855129
--- /dev/null
+++ b/Core/Scripts/ThirdParty/github/tests/Team.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+
+# ########################## Copyrights and license ############################
+# #
+# Copyright 2012 Vincent Jacques <[email protected]> #
+# Copyright 2012 Zearin <[email protected]> #
+# Copyright 2013 Vincent Jacques <[email protected]> #
+# #
+# This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
+# #
+# PyGithub is free software: you can redistribute it and/or modify it under #
+# the terms of the GNU Lesser General Public License as published by the Free #
+# Software Foundation, either version 3 of the License, or (at your option) #
+# any later version. #
+# #
+# PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
+# details. #
+# #
+# You should have received a copy of the GNU Lesser General Public License #
+# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
+# #
+# ##############################################################################
+
+import Framework
+
+
+class Team(Framework.TestCase):
+ def setUp(self):
+ Framework.TestCase.setUp(self)
+ self.org = self.g.get_organization("BeaverSoftware")
+ self.team = self.org.get_team(189850)
+
+ def testAttributes(self):
+ self.assertEqual(self.team.id, 189850)
+ self.assertEqual(self.team.members_count, 0)
+ self.assertEqual(self.team.name, "Team created by PyGithub")
+ self.assertEqual(self.team.permission, "pull")
+ self.assertEqual(self.team.repos_count, 0)
+ self.assertEqual(self.team.url, "https://api.github.com/teams/189850")
+
+ def testMembers(self):
+ user = self.g.get_user("jacquev6")
+ self.assertListKeyEqual(self.team.get_members(), None, [])
+ self.assertFalse(self.team.has_in_members(user))
+ self.team.add_to_members(user)
+ self.assertListKeyEqual(self.team.get_members(), lambda u: u.login, ["jacquev6"])
+ self.assertTrue(self.team.has_in_members(user))
+ self.team.remove_from_members(user)
+ self.assertListKeyEqual(self.team.get_members(), None, [])
+ self.assertFalse(self.team.has_in_members(user))
+
+ def testRepos(self):
+ repo = self.org.get_repo("FatherBeaver")
+ self.assertListKeyEqual(self.team.get_repos(), None, [])
+ self.assertFalse(self.team.has_in_repos(repo))
+ self.team.add_to_repos(repo)
+ self.assertListKeyEqual(self.team.get_repos(), lambda r: r.name, ["FatherBeaver"])
+ self.assertTrue(self.team.has_in_repos(repo))
+ self.team.remove_from_repos(repo)
+ self.assertListKeyEqual(self.team.get_repos(), None, [])
+ self.assertFalse(self.team.has_in_repos(repo))
+
+ def testEditWithoutArguments(self):
+ self.team.edit("Name edited by PyGithub")
+ self.assertEqual(self.team.name, "Name edited by PyGithub")
+
+ def testEditWithAllArguments(self):
+ self.team.edit("Name edited twice by PyGithub", "admin")
+ self.assertEqual(self.team.name, "Name edited twice by PyGithub")
+ self.assertEqual(self.team.permission, "admin")
+
+ def testDelete(self):
+ self.team.delete()