mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Test Team
This commit is contained in:
@@ -1041,6 +1041,13 @@
|
||||
{ "name": "repo_names", "type": "list" },
|
||||
{ "name": "permission", "type": "@todo" }
|
||||
]
|
||||
},
|
||||
"getElement": {
|
||||
"parameter": { "name": "id", "type": "integer" },
|
||||
"url" : [
|
||||
{ "type": "constant", "value": "https://api.github.com/teams/" },
|
||||
{ "type": "argument", "value": [ "id" ] }
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -6175,6 +6175,46 @@
|
||||
"name": "Team"
|
||||
}
|
||||
},
|
||||
{
|
||||
"group": "teams",
|
||||
"name": [
|
||||
"get",
|
||||
"team"
|
||||
],
|
||||
"mandatoryParameters": [
|
||||
{
|
||||
"type": {
|
||||
"simple": true,
|
||||
"cardinality": "scalar",
|
||||
"name": "integer"
|
||||
},
|
||||
"name": "id"
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"url": [
|
||||
{
|
||||
"type": "constant",
|
||||
"value": "https://api.github.com/teams/"
|
||||
},
|
||||
{
|
||||
"type": "argument",
|
||||
"value": [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"information": "data",
|
||||
"verb": "GET"
|
||||
},
|
||||
"isMutation": false,
|
||||
"optionalParameters": [],
|
||||
"type": {
|
||||
"simple": false,
|
||||
"cardinality": "scalar",
|
||||
"name": "Team"
|
||||
}
|
||||
},
|
||||
{
|
||||
"group": "teams",
|
||||
"name": [
|
||||
|
||||
@@ -809,6 +809,8 @@ Teams
|
||||
* `name`: string
|
||||
* `repo_names`: `list`
|
||||
* `permission`
|
||||
* `get_team( id )`: `Team`
|
||||
* `id`: integer
|
||||
* `get_teams()`: list of `Team`
|
||||
|
||||
Class `Permissions`
|
||||
|
||||
@@ -288,6 +288,15 @@ class Organization( object ):
|
||||
data
|
||||
)
|
||||
|
||||
def get_team( self, id ):
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
"https://api.github.com/teams/" + str( id ),
|
||||
None,
|
||||
None
|
||||
)
|
||||
return Team.Team( self.__requester, data, completion = NoCompletion )
|
||||
|
||||
def get_teams( self ):
|
||||
status, headers, data = self.__requester.request(
|
||||
"GET",
|
||||
|
||||
@@ -30,6 +30,7 @@ from RateLimiting import *
|
||||
from Repository import *
|
||||
from RepositoryKey import *
|
||||
from Tag import *
|
||||
from Team import *
|
||||
from UserKey import *
|
||||
|
||||
Framework.main()
|
||||
|
||||
@@ -44,3 +44,11 @@ class Organization( Framework.TestCase ):
|
||||
self.assertEqual( self.org.email, "BeaverSoftware2@vincent-jacques.net" )
|
||||
self.assertEqual( self.org.location, "Location edited by PyGithub" )
|
||||
self.assertEqual( self.org.name, "Name edited by PyGithub" )
|
||||
|
||||
def testCreateTeam( self ):
|
||||
team = self.org.create_team( "Team created by PyGithub" )
|
||||
self.assertEqual( team.id, 189850 )
|
||||
|
||||
def testCreateTeamWithAllArguments( self ):
|
||||
team = self.org.create_team( "Team also created by PyGithub", [ "BeaverSoftware/FatherBeaver" ], "push" )
|
||||
self.assertEqual( team.id, 189852 )
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
POST /orgs/BeaverSoftware/teams {'Authorization': 'Basic login_and_password_removed'} {"name": "Team created by PyGithub"}
|
||||
201
|
||||
[('status', '201 Created'), ('x-ratelimit-remaining', '4988'), ('content-length', '145'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"189a318993cde3e040f2efb4f634f8a8"'), ('date', 'Sat, 26 May 2012 20:58:53 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/teams/189850')]
|
||||
{"url":"https://api.github.com/teams/189850","members_count":0,"repos_count":0,"name":"Team created by PyGithub","permission":"pull","id":189850}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
POST /orgs/BeaverSoftware/teams {'Authorization': 'Basic login_and_password_removed'} {"repo_names": ["BeaverSoftware/FatherBeaver"], "name": "Team also created by PyGithub", "permission": "push"}
|
||||
201
|
||||
[('status', '201 Created'), ('x-ratelimit-remaining', '4982'), ('content-length', '150'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"6e3fb00de6ca4c112feee3a1438d6f0e"'), ('date', 'Sat, 26 May 2012 21:00:26 GMT'), ('content-type', 'application/json; charset=utf-8'), ('location', 'https://api.github.com/teams/189852')]
|
||||
{"repos_count":1,"url":"https://api.github.com/teams/189852","members_count":0,"name":"Team also created by PyGithub","permission":"push","id":189852}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
GET /orgs/BeaverSoftware {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4976'), ('content-length', '716'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"4862bcec9fa538316e2fcd73be37b846"'), ('date', 'Sat, 26 May 2012 21:09:52 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"public_gists":0,"type":"Organization","disk_usage":112,"private_gists":0,"public_repos":2,"url":"https://api.github.com/orgs/BeaverSoftware","total_private_repos":0,"plan":{"private_repos":0,"name":"free","space":307200},"blog":null,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","owned_private_repos":0,"collaborators":0,"company":null,"login":"BeaverSoftware","email":null,"followers":0,"name":null,"created_at":"2012-02-09T19:20:12Z","location":"Paris, France","id":1424031,"billing_email":"BeaverSoftware@vincent-jacques.net","following":0,"html_url":"https://github.com/BeaverSoftware"}
|
||||
|
||||
GET /teams/189850 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4975'), ('content-length', '145'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"03555a65309084f36bcf959063a39d35"'), ('date', 'Sat, 26 May 2012 21:09:52 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"repos_count":0,"url":"https://api.github.com/teams/189850","members_count":0,"name":"Team created by PyGithub","permission":"pull","id":189850}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
DELETE /teams/189850 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4946'), ('x-ratelimit-limit', '5000'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:16:46 GMT')]
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
PATCH /teams/189850 {'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited twice by PyGithub", "permission": "admin"}
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4949'), ('content-length', '151'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"8856425cedbdf3075576e823f39fc3d6"'), ('date', 'Sat, 26 May 2012 21:14:46 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"permission":"admin","members_count":0,"url":"https://api.github.com/teams/189850","repos_count":0,"name":"Name edited twice by PyGithub","id":189850}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
PATCH /teams/189850 {'Authorization': 'Basic login_and_password_removed'} {"name": "Name edited by PyGithub"}
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4952'), ('content-length', '144'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"843001aba6d35f27320c0788c9ff64b1"'), ('date', 'Sat, 26 May 2012 21:14:39 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"permission":"pull","members_count":0,"url":"https://api.github.com/teams/189850","repos_count":0,"name":"Name edited by PyGithub","id":189850}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
GET /users/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4974'), ('content-length', '801'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"fcfa200b026b10e9a41dfc2bb1057b33"'), ('date', 'Sat, 26 May 2012 21:09:53 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"private_gists":5,"collaborators":0,"type":"User","disk_usage":17016,"hireable":false,"url":"https://api.github.com/users/jacquev6","plan":{"collaborators":1,"name":"micro","private_repos":5,"space":614400},"public_repos":11,"bio":"","total_private_repos":5,"company":"Criteo","blog":"http://vincent-jacques.net","gravatar_id":"b68de5ae38616c296fa345d2b9df2225","avatar_url":"https://secure.gravatar.com/avatar/b68de5ae38616c296fa345d2b9df2225?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jacquev6","email":"vincent@vincent-jacques.net","owned_private_repos":5,"followers":13,"name":"Vincent Jacques","public_gists":3,"created_at":"2010-07-09T06:10:06Z","location":"Paris, France","id":327146,"following":24,"html_url":"https://github.com/jacquev6"}
|
||||
|
||||
GET /teams/189850/members {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4973'), ('content-length', '2'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d751713988987e9331980363e24189ce"'), ('date', 'Sat, 26 May 2012 21:09:54 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[]
|
||||
|
||||
GET /teams/189850/members/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
404
|
||||
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4972'), ('content-length', '23'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e66a7a6c91e2c26803f3f49feb7a883f"'), ('date', 'Sat, 26 May 2012 21:09:54 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"message":"Not Found"}
|
||||
|
||||
PUT /teams/189850/members/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4971'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:09:55 GMT')]
|
||||
|
||||
|
||||
GET /teams/189850/members {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4970'), ('content-length', '298'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"5c59999e9aff00a09d7aa96ad73d5ff2"'), ('date', 'Sat, 26 May 2012 21:09:56 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"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"}]
|
||||
|
||||
GET /teams/189850/members/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4969'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:09:56 GMT')]
|
||||
|
||||
|
||||
DELETE /teams/189850/members/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4968'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:09:57 GMT')]
|
||||
|
||||
|
||||
GET /teams/189850/members {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4967'), ('content-length', '2'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d751713988987e9331980363e24189ce"'), ('date', 'Sat, 26 May 2012 21:09:57 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[]
|
||||
|
||||
GET /teams/189850/members/jacquev6 {'Authorization': 'Basic login_and_password_removed'} null
|
||||
404
|
||||
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4966'), ('content-length', '23'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e66a7a6c91e2c26803f3f49feb7a883f"'), ('date', 'Sat, 26 May 2012 21:09:58 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"message":"Not Found"}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
GET /repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4963'), ('content-length', '1431'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"c9b98209a51840e6710aa96cb2e4eb56"'), ('date', 'Sat, 26 May 2012 21:12:35 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"organization":{"url":"https://api.github.com/users/BeaverSoftware","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"clone_url":"https://github.com/BeaverSoftware/FatherBeaver.git","mirror_url":null,"has_downloads":true,"watchers":2,"updated_at":"2012-02-16T21:51:15Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"","url":"https://api.github.com/repos/BeaverSoftware/FatherBeaver","has_wiki":true,"has_issues":true,"fork":false,"forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/FatherBeaver","git_url":"git://github.com/BeaverSoftware/FatherBeaver.git","owner":{"url":"https://api.github.com/users/BeaverSoftware","avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031},"name":"FatherBeaver","language":null,"description":"","ssh_url":"git@github.com:BeaverSoftware/FatherBeaver.git","pushed_at":null,"created_at":"2012-02-09T19:32:21Z","id":3400397,"html_url":"https://github.com/BeaverSoftware/FatherBeaver","full_name":"BeaverSoftware/FatherBeaver"}
|
||||
|
||||
GET /teams/189850/repos {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4962'), ('content-length', '2'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d751713988987e9331980363e24189ce"'), ('date', 'Sat, 26 May 2012 21:12:35 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[]
|
||||
|
||||
GET /teams/189850/repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null
|
||||
404
|
||||
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4961'), ('content-length', '23'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e66a7a6c91e2c26803f3f49feb7a883f"'), ('date', 'Sat, 26 May 2012 21:12:36 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"message":"Not Found"}
|
||||
|
||||
PUT /teams/189850/repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4960'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:12:36 GMT')]
|
||||
|
||||
|
||||
GET /teams/189850/repos {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4959'), ('content-length', '1107'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"f29ca00cf809ab0ca2bc42a50e067637"'), ('date', 'Sat, 26 May 2012 21:12:37 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[{"clone_url":"https://github.com/BeaverSoftware/FatherBeaver.git","has_downloads":true,"watchers":2,"updated_at":"2012-02-16T21:51:15Z","permissions":{"pull":true,"admin":true,"push":true},"homepage":"","url":"https://api.github.com/repos/BeaverSoftware/FatherBeaver","mirror_url":null,"has_wiki":true,"has_issues":true,"fork":false,"forks":1,"size":0,"private":false,"open_issues":0,"svn_url":"https://github.com/BeaverSoftware/FatherBeaver","owner":{"url":"https://api.github.com/users/BeaverSoftware","gravatar_id":"d563e337cac2fdc644e2aaaad1e23266","login":"BeaverSoftware","id":1424031,"avatar_url":"https://secure.gravatar.com/avatar/d563e337cac2fdc644e2aaaad1e23266?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png"},"name":"FatherBeaver","language":null,"description":"","ssh_url":"git@github.com:BeaverSoftware/FatherBeaver.git","pushed_at":null,"created_at":"2012-02-09T19:32:21Z","id":3400397,"git_url":"git://github.com/BeaverSoftware/FatherBeaver.git","html_url":"https://github.com/BeaverSoftware/FatherBeaver","full_name":"BeaverSoftware/FatherBeaver"}]
|
||||
|
||||
GET /teams/189850/repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4958'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:12:38 GMT')]
|
||||
|
||||
|
||||
DELETE /teams/189850/repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null
|
||||
204
|
||||
[('status', '204 No Content'), ('x-ratelimit-remaining', '4957'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d41d8cd98f00b204e9800998ecf8427e"'), ('date', 'Sat, 26 May 2012 21:12:38 GMT')]
|
||||
|
||||
|
||||
GET /teams/189850/repos {'Authorization': 'Basic login_and_password_removed'} null
|
||||
200
|
||||
[('status', '200 OK'), ('x-ratelimit-remaining', '4956'), ('content-length', '2'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"d751713988987e9331980363e24189ce"'), ('date', 'Sat, 26 May 2012 21:12:39 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
[]
|
||||
|
||||
GET /teams/189850/repos/BeaverSoftware/FatherBeaver {'Authorization': 'Basic login_and_password_removed'} null
|
||||
404
|
||||
[('status', '404 Not Found'), ('x-ratelimit-remaining', '4955'), ('content-length', '23'), ('server', 'nginx/1.0.13'), ('connection', 'keep-alive'), ('x-ratelimit-limit', '5000'), ('etag', '"e66a7a6c91e2c26803f3f49feb7a883f"'), ('date', 'Sat, 26 May 2012 21:12:39 GMT'), ('content-type', 'application/json; charset=utf-8')]
|
||||
{"message":"Not Found"}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
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(), lambda u: u.login, [] )
|
||||
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(), lambda u: u.login, [] )
|
||||
self.assertFalse( self.team.has_in_members( user ) )
|
||||
|
||||
def testRepos( self ):
|
||||
repo = self.org.get_repo( "FatherBeaver" )
|
||||
self.assertListKeyEqual( self.team.get_repos(), lambda r: r.name, [] )
|
||||
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(), lambda r: r.name, [] )
|
||||
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()
|
||||
Reference in New Issue
Block a user