-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #15 Fix #13 * Add dynamic attribute from _links * remove old repsonse.json * Add Atachment object and download method * try to fix test * escape / * add revisions as property * Add more docs * omit test coverage * duplicate test name * source dir to coverage * rtfm codacy manual * Add docs, deploy on develop\master only * star repo
- Loading branch information
Showing
29 changed files
with
667 additions
and
543 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
exclude_paths: | ||
- tests/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
Advanced usage | ||
-------------- | ||
|
||
# Table of Contents | ||
- [TFSObject](#tfsobject) | ||
- [Workitem](#workitem) | ||
- [Relations](#relations) | ||
- [Links](#links) | ||
- [TFSHTTPClient](#tfshttpclient) | ||
|
||
# TFSObject | ||
All `TFSObject` instances contain raw TFS response (in JSON, which was converted to python-dict) in `self.data` | ||
|
||
```python | ||
workitem = client.get_workitem(100) | ||
print(workitem.data) | ||
|
||
history = workitem.history | ||
print(history.data) | ||
|
||
revisions = workitem.revisions | ||
print(revisions.data) | ||
|
||
attachment = workitem.attachments[0] | ||
print(attachment.data) | ||
``` | ||
|
||
All `TFSObject` instances have `self.url`, `self.uri`: | ||
```python | ||
workitem = client.get_workitem(100) | ||
|
||
# Full URL with https points to API object | ||
print(workitem.url) | ||
|
||
# URI points to API object | ||
print(workitem.uri) | ||
|
||
``` | ||
|
||
# Workitem | ||
|
||
## Relations | ||
Workitem has relation with other object. This library support only `workitem.childs`, `workitem.parent`, and `workitem.attachments` | ||
Read more about [TFS link types](https://docs.microsoft.com/en-us/vsts/work/customize/reference/link-type-element-reference#link-types) | ||
|
||
If you need find other type, you can use `workitem.find_in_relations` method: | ||
```python | ||
workitem = client.get_workitem(100) | ||
|
||
# links is Dict | ||
links = workitem.find_in_relations('Hyperlink') | ||
|
||
# duplicates is Dict | ||
# Really type is System.LinkTypes.Duplicate-Forward, but it will be found | ||
duplicates = workitem.find_in_relations('Duplicate-Forward') | ||
``` | ||
|
||
## Links | ||
Some `TFSObject` have `_links` in their data. You can acces to this data as raw or get new `TFSObject`: | ||
```python | ||
workitem = client.get_workitem(100) | ||
|
||
# This links also in dir() | ||
dir(workitem) | ||
|
||
# Get TFSObject | ||
workitem.workItemHistory # list of object | ||
workitem.workItemRevisions # list of object | ||
workitem.workItemType # TFSObject | ||
|
||
# Get raw data | ||
links = workitem.data['_links'] | ||
print(links) | ||
|
||
``` | ||
|
||
## TFSHTTPClient | ||
**TODO**: Describe how other people can use some usefull function and object from `tfs.connection` | ||
- Get from TFSAPI | ||
- `send_*` methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Table of Contents | ||
- [Contribute](#contribute) | ||
- [Development](#development) | ||
- [Tests](#tests) | ||
|
||
# Contribute | ||
We will be grateful to see you in the ranks of the contributors! We have [some esay issue](https://github.com/devopshq/tfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22), which will suit as first issue or for junior python | ||
|
||
## Development | ||
Development takes place on GitHub, where the git-flow branch structure is used: | ||
|
||
* ``master`` - contains the latest released code. | ||
* ``develop`` - is used for development of the next release. **Pull request must be in this branch** | ||
* ``feature/XXX`` - feature branches are used for development of new features before they are merged to ``develop``. | ||
|
||
## Tests | ||
We use HTTPPrety. For GET-response locate you response.json to folder by URL. E.g: | ||
- http://tfs.tfs.ru/tfs/DefaultCollection/_apis/wit/workitems?ids=anyid&anyflag => **tests/resources/tfs/DefaultCollection/_apis/wit/workitems/response.json** | ||
- http://tfs.tfs.ru/tfs/DefaultCollection/_apis/tfvc/changesets/10/workItems => **tests/resources/tfs/DefaultCollection/_apis/tfvc/changesets/10/workItems/response.json** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Table of Contents | ||
- [Changesets](#changesets) | ||
- [Project & Team](#project--team) | ||
|
||
|
||
# Changesets | ||
```python | ||
# Get changesets from 1000 to 1002 | ||
changesets = client.get_changesets(from_=1000, to_=1002) | ||
|
||
# Get changesets and related Workitems | ||
changesets = client.get_changesets(top=1) | ||
linked_workitems = changesets[0].workitems | ||
``` | ||
|
||
# Project & Team | ||
```python | ||
# Get all project | ||
all_projects = client.get_projects() | ||
|
||
# Get project | ||
project_name = client.get_project("MyProjectName") | ||
|
||
# Get project team | ||
project_team = project_name.team | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...DefaultCollection/_apis/projects/26e73aff-d80b-430d-b95c-76140bf184de/teams/response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
{ | ||
"id": "26e73aff-d80b-430d-b95c-76140bf184de", | ||
"name": "ProjectName", | ||
"url": "https:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/_apis\/projects\/26e73aff-d80b-430d-b95c-76140bf184de", | ||
"url": "http:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/_apis\/projects\/26e73aff-d80b-430d-b95c-76140bf184de", | ||
"state": "wellFormed", | ||
"_links": { | ||
"self": { | ||
"href": "https:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/_apis\/projects\/26e73aff-d80b-430d-b95c-76140bf184de" | ||
"href": "http:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/_apis\/projects\/26e73aff-d80b-430d-b95c-76140bf184de" | ||
}, | ||
"collection": { | ||
"href": "https:\/\/tfs.tfs.ru\/tfs\/_apis\/projectCollections\/9025d248-2b1b-48a7-bb43-8abf779eeeaa" | ||
"href": "http:\/\/tfs.tfs.ru\/tfs\/_apis\/projectCollections\/9025d248-2b1b-48a7-bb43-8abf779eeeaa" | ||
}, | ||
"web": { | ||
"href": "https:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/ProjectName" | ||
"href": "http:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/ProjectName" | ||
} | ||
}, | ||
"defaultTeam": { | ||
"id": "6475f0ad-b08b-4a74-8576-d80baf80600a", | ||
"name": "ProjectName Team", | ||
"url": "https:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/_apis\/projects\/26e73aff-d80b-430d-b95c-76140bf184de\/teams\/6475f0ad-b08b-4a74-8576-d80baf80600a" | ||
"url": "http:\/\/tfs.tfs.ru\/tfs\/DefaultCollection\/_apis\/projects\/26e73aff-d80b-430d-b95c-76140bf184de\/teams\/6475f0ad-b08b-4a74-8576-d80baf80600a" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.