forked from nephila/python-taiga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
93 lines (63 loc) · 1.98 KB
/
demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- coding: utf-8 -*-
from taiga import TaigaAPI
from taiga.exceptions import TaigaException
api = TaigaAPI(
host='http://127.0.0.1:8000'
)
api.auth(
username='admin',
password='123123'
)
print (api.me())
new_project = api.projects.create('TEST PROJECT', 'TESTING API')
new_project.name = 'TEST PROJECT 3'
new_project.update()
print (new_project.members)
for member in new_project.members:
print (member)
jan_feb_milestone = new_project.add_milestone(
'New milestone jan feb', '2015-01-26', '2015-02-26'
)
userstory = new_project.add_user_story(
'New Story', description='Blablablabla',
milestone=jan_feb_milestone.id
)
userstory.attach('README.md')
userstory.add_task('New Task 2',
new_project.task_statuses[0].id
).attach('README.md')
print (userstory.list_tasks())
newissue = new_project.add_issue(
'New Issue',
new_project.priorities.get(name='High').id,
new_project.issue_statuses.get(name='New').id,
new_project.issue_types.get(name='Bug').id,
new_project.severities.get(name='Minor').id,
description='Bug #5'
).attach('README.md')
projects = api.projects.list()
print (projects)
stories = api.user_stories.list()
print (stories)
print (api.history.user_story.get(stories[0].id))
try:
projects[0].star()
except TaigaException:
projects[0].like()
api.milestones.list()
projects = api.projects.list()
print (projects)
another_new_project = projects.get(name='TEST PROJECT 3')
print (another_new_project)
users = api.users.list()
print (users)
print (api.search(projects.get(name='TEST PROJECT 3').id, 'New').user_stories[0].subject)
print new_project.add_issue_attribute(
'Device', description='(iPad, iPod, iPhone, Desktop, etc.)'
)
print(new_project.roles)
memberships = new_project.list_memberships()
new_project.add_role('New role', permissions=["add_issue", "modify_issue"])
new_project.add_membership('stagi.andrea@gmail.com', new_project.roles[0].id)
for membership in memberships:
print (membership.role_name)