SurveyMonkey / pyteamcity

Use the TeamCity REST API from Python
51 stars 50 forks source link

Add get_projects; replaces get_all_projects #18

Closed msabramo closed 9 years ago

msabramo commented 9 years ago
In [1]: from pyteamcity import TeamCity

In [2]: tc = TeamCity()

In [3]: tc.get_projects()
Out[3]:
{u'count': 188,
 u'href': u'/httpAuth/app/rest/projects',
 u'project': [{u'description': u'Contains all other projects',
   u'href': u'/httpAuth/app/rest/projects/id:_Root',
   u'id': u'_Root',
   u'name': u'<Root project>',
   u'webUrl': u'http://tcserver/project.html?projectId=_Root'},
  {u'href': u'/httpAuth/app/rest/projects/id:Admintools',
   u'id': u'Admintools',
   u'name': u'admintools',
   u'parentProjectId': u'_Root',
   u'webUrl': u'http://tcserver/project.html?projectId=Admintools'},
...

In [4]: tc.get_projects(parent_project_id='Admintools')
Out[4]:
[{u'href': u'/httpAuth/app/rest/projects/id:Admintools_Branches',
  u'id': u'Admintools_Branches',
  u'name': u'branches',
  u'parentProjectId': u'Admintools',
  u'webUrl': u'http://tcserver/project.html?projectId=Admintools_Branches'},
 {u'href': u'/httpAuth/app/rest/projects/id:Admintools_PullRequests',
  u'id': u'Admintools_PullRequests',
  u'name': u'pull requests',
  u'parentProjectId': u'Admintools',
  u'webUrl': u'http://tcserver/project.html?projectId=Admintools_PullRequests'},
...
msabramo commented 9 years ago

Need to update tests.

msabramo commented 9 years ago

Tests updated and passing.