forked from alexcouper/pyrally
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproof.py
155 lines (124 loc) · 5.08 KB
/
proof.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import time
from pyrally.client import RallyAPIClient
from pyrally import settings
from pyrally.models import Story, Artifact, Task, User
rac = RallyAPIClient(settings.RALLY_USERNAME,
settings.RALLY_PASSWORD,
settings.BASE_URL)
rac.rally_access.default_cache_timeout = 0
print settings.BASE_URL, settings.RALLY_USERNAME
def sort_by_rank(story_a, story_b):
return cmp(story_a.Rank, story_b.Rank)
from pyrally.models import get_query_clauses
stories = Story.get_all_in_iteration("Sprint 101")
stories.sort(sort_by_rank)
for s in stories:
print s.FormattedID, s.Name, s.Rank, s.KanbanState
story_to_change = stories[1]
if story_to_change.KanbanState == 'In Development':
state = 'In RC review'
else:
state = 'In Development'
story_to_change.KanbanState = state
del story_to_change.rally_data['Rank']
story_to_change.update_rally()
print 'AFTER'
stories = Story.get_all_in_iteration("Sprint 101")
stories.sort(sort_by_rank)
for s in stories:
print s.FormattedID, s.Name, s.Rank, s.KanbanState
# clause_1 = get_query_clauses([
# 'WorkProduct.Owner = "[email protected]"',
# 'WorkProduct.Owner = "[email protected]"',
# 'WorkProduct.Owner = "[email protected]"',
# 'WorkProduct.Owner = "[email protected]"',
# 'WorkProduct.Owner = "[email protected]"',
# ], ' or ')
# clause_1 = get_query_clauses([
# 'WorkProduct.Owner = "[email protected]"',
# 'WorkProduct.Owner = "[email protected]"',
# 'WorkProduct.Owner = "[email protected]"',
# ], ' or ')
# # clause_1 = get_query_clauses([
# # 'WorkProduct.Owner = "[email protected]"',
# # 'WorkProduct.Owner = "[email protected]"',
# # 'WorkProduct.Owner = "[email protected]"',
# # 'WorkProduct.Owner = "[email protected]"',
# # 'WorkProduct.Owner = "[email protected]"',
# # ], ' or ')
# full_clause = get_query_clauses(['Iteration.Name = "Sprint 18"', clause_1])
# print full_clause
# story = Story.get_by_formatted_id('us98')
# print story.rally_url
# (Iteration.Name = "Sprint 18") and (((WorkProduct.Owner = "[email protected]") or (WorkProduct.Owner = "[email protected]")) or (WorkProduct.Owner = "[email protected]"))
# (Iteration.Name = "Sprint 18") and (((((WorkProduct.Owner = "[email protected]") or (WorkProduct.Owner = "[email protected]")) or (WorkProduct.Owner = "[email protected]")) or (WorkProduct.Owner = "[email protected]")) or (WorkProduct.Owner = "[email protected]"))
# clauses = ['DisplayName = "Alex C"']
# owner = User.get_all(clauses)[0]
# # Now add a task to the story in Rally
# task = Task({'Name': 'First task {0}'.format(time.ctime()),
# 'Status': 'Defined',
# 'WorkProduct': story.ref,
# 'Owner': owner.ref})
# task.update_rally()
#stories = rac.get_all_in_kanban_states(['In QA Testing',
# 'In Development'])['stories']
#print len(stories)
# def print_times(time_list):
# last_t = 0
# for i, t in enumerate(time_list):
# if last_t:
# print i, t-last_t
# last_t = t
# Story.set_cache_timeout(100)
# times = []
# times.append(time.time())
# Story.get_all()
# times.append(time.time())
# Story.get_all()[0].tasks
# times.append(time.time())
# print_times(times)
# from pyrally.rally_access import MEM_CACHE
# print MEM_CACHE.keys()
# print rac.rally_access.cache_timeouts
#all_stories = Story.get_all()
#print len(all_stories)
#print Artifact.get_all_in_kanban_state('In Development')
#print Story.get_all_in_kanban_state('In Development')
# all_stories = Story.get_all()
# print len(all_stories)
# story = rac.get_story_by_name('us524')
# print story
# print story.Owner.DisplayName
# story = rac.get_story_by_name('us124')
# print story.__dict__
# print story.Owner
# print story.title
# dict_obj = rac.get_all_in_kanban_state('In QA Testing')
# print dict_obj
# story = rac.get_entity_by_name('us524')
# defect = rac.get_entity_by_name('de92')
# print story.title
# print defect.title
# story = rac.get_story_by_name('us524')
# print story.Description
# print story.title
# print story.FormattedID
# print story.Blocked
# defect = rac.get_defect_by_name('de92')
# print defect.Description
# print defect.title
# print defect.FormattedID
# print defect.tasks
# print defect.Blocked
# all_entities = rac.get_all_entities()
# print len(all_entities)
# print dict_obj
# for story in dict_obj['stories']:
# print story.__dict__
# print story.Tasks
# print story.tasks
# print story.mbfshipmenthandling
# print story.mbfwarehousescreens
# for kb_state in KANBAN_STATES:
# objs = rac.get_all_in_kanban_state(kb_state)
# print kb_state, objs