peaty 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,156 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <stories type="array" count="12" total="12">
3
+ <story>
4
+ <id type="integer">6822209</id>
5
+ <project_id type="integer">153937</project_id>
6
+ <story_type>chore</story_type>
7
+ <url>http://www.pivotaltracker.com/story/show/6822209</url>
8
+ <current_state>unstarted</current_state>
9
+ <description></description>
10
+ <name>Stuff needs to be defined</name>
11
+ <requested_by>Matt Todd</requested_by>
12
+ <created_at type="datetime">2010/11/29 01:39:41 EST</created_at>
13
+ <updated_at type="datetime">2010/11/29 01:39:45 EST</updated_at>
14
+ </story>
15
+ <story>
16
+ <id type="integer">6821125</id>
17
+ <project_id type="integer">153937</project_id>
18
+ <story_type>feature</story_type>
19
+ <url>http://www.pivotaltracker.com/story/show/6821125</url>
20
+ <estimate type="integer">0</estimate>
21
+ <current_state>unstarted</current_state>
22
+ <description></description>
23
+ <name>Stuff can be done</name>
24
+ <requested_by>Matt Todd</requested_by>
25
+ <created_at type="datetime">2010/11/29 00:30:39 EST</created_at>
26
+ <updated_at type="datetime">2010/11/29 00:31:12 EST</updated_at>
27
+ </story>
28
+ <story>
29
+ <id type="integer">6821071</id>
30
+ <project_id type="integer">153937</project_id>
31
+ <story_type>feature</story_type>
32
+ <url>http://www.pivotaltracker.com/story/show/6821071</url>
33
+ <estimate type="integer">1</estimate>
34
+ <current_state>unstarted</current_state>
35
+ <description></description>
36
+ <name>Users can do stuff</name>
37
+ <requested_by>Matt Todd</requested_by>
38
+ <created_at type="datetime">2010/11/29 00:27:38 EST</created_at>
39
+ <updated_at type="datetime">2010/11/29 00:27:51 EST</updated_at>
40
+ </story>
41
+ <story>
42
+ <id type="integer">6821077</id>
43
+ <project_id type="integer">153937</project_id>
44
+ <story_type>feature</story_type>
45
+ <url>http://www.pivotaltracker.com/story/show/6821077</url>
46
+ <estimate type="integer">2</estimate>
47
+ <current_state>unstarted</current_state>
48
+ <description></description>
49
+ <name>Admins can also do stuff</name>
50
+ <requested_by>Matt Todd</requested_by>
51
+ <created_at type="datetime">2010/11/29 00:27:46 EST</created_at>
52
+ <updated_at type="datetime">2010/11/29 00:27:53 EST</updated_at>
53
+ </story>
54
+ <story>
55
+ <id type="integer">6821081</id>
56
+ <project_id type="integer">153937</project_id>
57
+ <story_type>feature</story_type>
58
+ <url>http://www.pivotaltracker.com/story/show/6821081</url>
59
+ <estimate type="integer">3</estimate>
60
+ <current_state>unstarted</current_state>
61
+ <description></description>
62
+ <name>Other Users cannot do stuff</name>
63
+ <requested_by>Matt Todd</requested_by>
64
+ <created_at type="datetime">2010/11/29 00:28:04 EST</created_at>
65
+ <updated_at type="datetime">2010/11/29 00:28:08 EST</updated_at>
66
+ </story>
67
+ <story>
68
+ <id type="integer">6821121</id>
69
+ <project_id type="integer">153937</project_id>
70
+ <story_type>release</story_type>
71
+ <url>http://www.pivotaltracker.com/story/show/6821121</url>
72
+ <current_state>unstarted</current_state>
73
+ <description></description>
74
+ <name>Stuff is working</name>
75
+ <requested_by>Matt Todd</requested_by>
76
+ <created_at type="datetime">2010/11/29 00:30:20 EST</created_at>
77
+ <updated_at type="datetime">2010/11/29 00:30:33 EST</updated_at>
78
+ </story>
79
+ <story>
80
+ <id type="integer">6822203</id>
81
+ <project_id type="integer">153937</project_id>
82
+ <story_type>bug</story_type>
83
+ <url>http://www.pivotaltracker.com/story/show/6822203</url>
84
+ <current_state>unstarted</current_state>
85
+ <description></description>
86
+ <name>Other Users can do anything</name>
87
+ <requested_by>Matt Todd</requested_by>
88
+ <created_at type="datetime">2010/11/29 01:39:21 EST</created_at>
89
+ <updated_at type="datetime">2010/11/29 01:40:07 EST</updated_at>
90
+ </story>
91
+ <story>
92
+ <id type="integer">6821087</id>
93
+ <project_id type="integer">153937</project_id>
94
+ <story_type>feature</story_type>
95
+ <url>http://www.pivotaltracker.com/story/show/6821087</url>
96
+ <estimate type="integer">1</estimate>
97
+ <current_state>unstarted</current_state>
98
+ <description></description>
99
+ <name>Admins can do stuff as other Users</name>
100
+ <requested_by>Matt Todd</requested_by>
101
+ <created_at type="datetime">2010/11/29 00:28:26 EST</created_at>
102
+ <updated_at type="datetime">2010/11/29 00:28:31 EST</updated_at>
103
+ </story>
104
+ <story>
105
+ <id type="integer">6821093</id>
106
+ <project_id type="integer">153937</project_id>
107
+ <story_type>feature</story_type>
108
+ <url>http://www.pivotaltracker.com/story/show/6821093</url>
109
+ <estimate type="integer">2</estimate>
110
+ <current_state>unstarted</current_state>
111
+ <description></description>
112
+ <name>Stuffs can be searched for\ by Users</name>
113
+ <requested_by>Matt Todd</requested_by>
114
+ <created_at type="datetime">2010/11/29 00:28:45 EST</created_at>
115
+ <updated_at type="datetime">2010/11/29 00:29:46 EST</updated_at>
116
+ </story>
117
+ <story>
118
+ <id type="integer">6821103</id>
119
+ <project_id type="integer">153937</project_id>
120
+ <story_type>feature</story_type>
121
+ <url>http://www.pivotaltracker.com/story/show/6821103</url>
122
+ <estimate type="integer">1</estimate>
123
+ <current_state>unstarted</current_state>
124
+ <description></description>
125
+ <name>Stuff can be tagged</name>
126
+ <requested_by>Matt Todd</requested_by>
127
+ <created_at type="datetime">2010/11/29 00:29:07 EST</created_at>
128
+ <updated_at type="datetime">2010/11/29 00:29:09 EST</updated_at>
129
+ </story>
130
+ <story>
131
+ <id type="integer">6821107</id>
132
+ <project_id type="integer">153937</project_id>
133
+ <story_type>feature</story_type>
134
+ <url>http://www.pivotaltracker.com/story/show/6821107</url>
135
+ <estimate type="integer">2</estimate>
136
+ <current_state>unstarted</current_state>
137
+ <description></description>
138
+ <name>Tags make stuff show up higher in the search results</name>
139
+ <requested_by>Matt Todd</requested_by>
140
+ <created_at type="datetime">2010/11/29 00:29:32 EST</created_at>
141
+ <updated_at type="datetime">2010/11/29 00:30:00 EST</updated_at>
142
+ </story>
143
+ <story>
144
+ <id type="integer">6821113</id>
145
+ <project_id type="integer">153937</project_id>
146
+ <story_type>feature</story_type>
147
+ <url>http://www.pivotaltracker.com/story/show/6821113</url>
148
+ <estimate type="integer">1</estimate>
149
+ <current_state>unscheduled</current_state>
150
+ <description></description>
151
+ <name>Stuff can do magic</name>
152
+ <requested_by>Matt Todd</requested_by>
153
+ <created_at type="datetime">2010/11/29 00:30:06 EST</created_at>
154
+ <updated_at type="datetime">2010/11/29 00:30:08 EST</updated_at>
155
+ </story>
156
+ </stories>
@@ -0,0 +1,186 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <stories type="array" count="14" filter="includedone:true" total="14">
3
+ <story>
4
+ <id type="integer">6914449</id>
5
+ <project_id type="integer">153937</project_id>
6
+ <story_type>release</story_type>
7
+ <url>http://www.pivotaltracker.com/story/show/6914449</url>
8
+ <current_state>accepted</current_state>
9
+ <description></description>
10
+ <name>Stuff is awesome</name>
11
+ <requested_by>Chris Kelly</requested_by>
12
+ <owned_by>Matt Todd</owned_by>
13
+ <created_at type="datetime">2010/12/01 00:46:24 EST</created_at>
14
+ <updated_at type="datetime">2010/12/01 00:47:42 EST</updated_at>
15
+ <accepted_at type="datetime">2010/11/26 12:00:00 EST</accepted_at>
16
+ </story>
17
+ <story>
18
+ <id type="integer">6914397</id>
19
+ <project_id type="integer">153937</project_id>
20
+ <story_type>release</story_type>
21
+ <url>http://www.pivotaltracker.com/story/show/6914397</url>
22
+ <current_state>accepted</current_state>
23
+ <description></description>
24
+ <name>Stuff has been thought of</name>
25
+ <requested_by>Chris Kelly</requested_by>
26
+ <owned_by>Matt Todd</owned_by>
27
+ <created_at type="datetime">2010/12/01 00:41:53 EST</created_at>
28
+ <updated_at type="datetime">2010/12/01 00:42:07 EST</updated_at>
29
+ <accepted_at type="datetime">2010/12/01 00:42:07 EST</accepted_at>
30
+ <deadline type="datetime">2010/12/01 12:00:00 EST</deadline>
31
+ <labels>hmm</labels>
32
+ </story>
33
+ <story>
34
+ <id type="integer">6822209</id>
35
+ <project_id type="integer">153937</project_id>
36
+ <story_type>chore</story_type>
37
+ <url>http://www.pivotaltracker.com/story/show/6822209</url>
38
+ <current_state>unstarted</current_state>
39
+ <description></description>
40
+ <name>Stuff needs to be defined</name>
41
+ <requested_by>Matt Todd</requested_by>
42
+ <created_at type="datetime">2010/11/29 01:39:41 EST</created_at>
43
+ <updated_at type="datetime">2010/11/29 01:39:45 EST</updated_at>
44
+ </story>
45
+ <story>
46
+ <id type="integer">6821125</id>
47
+ <project_id type="integer">153937</project_id>
48
+ <story_type>feature</story_type>
49
+ <url>http://www.pivotaltracker.com/story/show/6821125</url>
50
+ <estimate type="integer">0</estimate>
51
+ <current_state>unstarted</current_state>
52
+ <description></description>
53
+ <name>Stuff can be done</name>
54
+ <requested_by>Matt Todd</requested_by>
55
+ <created_at type="datetime">2010/11/29 00:30:39 EST</created_at>
56
+ <updated_at type="datetime">2010/11/29 00:31:12 EST</updated_at>
57
+ </story>
58
+ <story>
59
+ <id type="integer">6821071</id>
60
+ <project_id type="integer">153937</project_id>
61
+ <story_type>feature</story_type>
62
+ <url>http://www.pivotaltracker.com/story/show/6821071</url>
63
+ <estimate type="integer">1</estimate>
64
+ <current_state>unstarted</current_state>
65
+ <description></description>
66
+ <name>Users can do stuff</name>
67
+ <requested_by>Matt Todd</requested_by>
68
+ <created_at type="datetime">2010/11/29 00:27:38 EST</created_at>
69
+ <updated_at type="datetime">2010/11/29 00:27:51 EST</updated_at>
70
+ </story>
71
+ <story>
72
+ <id type="integer">6821077</id>
73
+ <project_id type="integer">153937</project_id>
74
+ <story_type>feature</story_type>
75
+ <url>http://www.pivotaltracker.com/story/show/6821077</url>
76
+ <estimate type="integer">2</estimate>
77
+ <current_state>unstarted</current_state>
78
+ <description></description>
79
+ <name>Admins can also do stuff</name>
80
+ <requested_by>Matt Todd</requested_by>
81
+ <created_at type="datetime">2010/11/29 00:27:46 EST</created_at>
82
+ <updated_at type="datetime">2010/11/29 00:27:53 EST</updated_at>
83
+ </story>
84
+ <story>
85
+ <id type="integer">6821081</id>
86
+ <project_id type="integer">153937</project_id>
87
+ <story_type>feature</story_type>
88
+ <url>http://www.pivotaltracker.com/story/show/6821081</url>
89
+ <estimate type="integer">3</estimate>
90
+ <current_state>unstarted</current_state>
91
+ <description></description>
92
+ <name>Other Users cannot do stuff</name>
93
+ <requested_by>Matt Todd</requested_by>
94
+ <created_at type="datetime">2010/11/29 00:28:04 EST</created_at>
95
+ <updated_at type="datetime">2010/11/29 00:28:08 EST</updated_at>
96
+ </story>
97
+ <story>
98
+ <id type="integer">6821121</id>
99
+ <project_id type="integer">153937</project_id>
100
+ <story_type>release</story_type>
101
+ <url>http://www.pivotaltracker.com/story/show/6821121</url>
102
+ <current_state>unstarted</current_state>
103
+ <description></description>
104
+ <name>Stuff is working</name>
105
+ <requested_by>Matt Todd</requested_by>
106
+ <created_at type="datetime">2010/11/29 00:30:20 EST</created_at>
107
+ <updated_at type="datetime">2010/11/29 00:30:33 EST</updated_at>
108
+ </story>
109
+ <story>
110
+ <id type="integer">6822203</id>
111
+ <project_id type="integer">153937</project_id>
112
+ <story_type>bug</story_type>
113
+ <url>http://www.pivotaltracker.com/story/show/6822203</url>
114
+ <current_state>unstarted</current_state>
115
+ <description></description>
116
+ <name>Other Users can do anything</name>
117
+ <requested_by>Matt Todd</requested_by>
118
+ <created_at type="datetime">2010/11/29 01:39:21 EST</created_at>
119
+ <updated_at type="datetime">2010/11/29 01:40:07 EST</updated_at>
120
+ </story>
121
+ <story>
122
+ <id type="integer">6821087</id>
123
+ <project_id type="integer">153937</project_id>
124
+ <story_type>feature</story_type>
125
+ <url>http://www.pivotaltracker.com/story/show/6821087</url>
126
+ <estimate type="integer">1</estimate>
127
+ <current_state>unstarted</current_state>
128
+ <description></description>
129
+ <name>Admins can do stuff as other Users</name>
130
+ <requested_by>Matt Todd</requested_by>
131
+ <created_at type="datetime">2010/11/29 00:28:26 EST</created_at>
132
+ <updated_at type="datetime">2010/11/29 00:28:31 EST</updated_at>
133
+ </story>
134
+ <story>
135
+ <id type="integer">6821093</id>
136
+ <project_id type="integer">153937</project_id>
137
+ <story_type>feature</story_type>
138
+ <url>http://www.pivotaltracker.com/story/show/6821093</url>
139
+ <estimate type="integer">2</estimate>
140
+ <current_state>unstarted</current_state>
141
+ <description></description>
142
+ <name>Stuffs can be searched for by Users</name>
143
+ <requested_by>Matt Todd</requested_by>
144
+ <created_at type="datetime">2010/11/29 00:28:45 EST</created_at>
145
+ <updated_at type="datetime">2010/12/01 00:45:55 EST</updated_at>
146
+ </story>
147
+ <story>
148
+ <id type="integer">6821103</id>
149
+ <project_id type="integer">153937</project_id>
150
+ <story_type>feature</story_type>
151
+ <url>http://www.pivotaltracker.com/story/show/6821103</url>
152
+ <estimate type="integer">1</estimate>
153
+ <current_state>unstarted</current_state>
154
+ <description></description>
155
+ <name>Stuff can be tagged</name>
156
+ <requested_by>Matt Todd</requested_by>
157
+ <created_at type="datetime">2010/11/29 00:29:07 EST</created_at>
158
+ <updated_at type="datetime">2010/11/29 00:29:09 EST</updated_at>
159
+ </story>
160
+ <story>
161
+ <id type="integer">6821107</id>
162
+ <project_id type="integer">153937</project_id>
163
+ <story_type>feature</story_type>
164
+ <url>http://www.pivotaltracker.com/story/show/6821107</url>
165
+ <estimate type="integer">2</estimate>
166
+ <current_state>unstarted</current_state>
167
+ <description></description>
168
+ <name>Tags make stuff show up higher in the search results</name>
169
+ <requested_by>Matt Todd</requested_by>
170
+ <created_at type="datetime">2010/11/29 00:29:32 EST</created_at>
171
+ <updated_at type="datetime">2010/11/29 00:30:00 EST</updated_at>
172
+ </story>
173
+ <story>
174
+ <id type="integer">6821113</id>
175
+ <project_id type="integer">153937</project_id>
176
+ <story_type>feature</story_type>
177
+ <url>http://www.pivotaltracker.com/story/show/6821113</url>
178
+ <estimate type="integer">1</estimate>
179
+ <current_state>unscheduled</current_state>
180
+ <description></description>
181
+ <name>Stuff can do magic</name>
182
+ <requested_by>Matt Todd</requested_by>
183
+ <created_at type="datetime">2010/11/29 00:30:06 EST</created_at>
184
+ <updated_at type="datetime">2010/11/29 00:30:08 EST</updated_at>
185
+ </story>
186
+ </stories>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <story>
3
+ <id type="integer">6821071</id>
4
+ <project_id type="integer">153937</project_id>
5
+ <story_type>feature</story_type>
6
+ <url>http://www.pivotaltracker.com/story/show/6821071</url>
7
+ <estimate type="integer">1</estimate>
8
+ <current_state>unstarted</current_state>
9
+ <description></description>
10
+ <name>Users can do stuff</name>
11
+ <requested_by>Matt Todd</requested_by>
12
+ <created_at type="datetime">2010/11/29 00:27:38 EST</created_at>
13
+ <updated_at type="datetime">2010/11/29 00:27:51 EST</updated_at>
14
+ </story>
@@ -0,0 +1,90 @@
1
+ require 'test_helper'
2
+
3
+ class PeatyTest < Test::Unit::TestCase
4
+
5
+ def setup
6
+ RestClient.log = Logger.new(File.join(File.dirname(__FILE__), 'test.log'))
7
+ # All test's use TEST_TOKEN which is a valid API key""
8
+ @user = User.new(TEST_TOKEN)
9
+ end
10
+
11
+ # Tests for Projects
12
+ def test_user_can_fetch_a_project
13
+ project = @user.pivotal_tracker_projects.find(PROJECT_ID)
14
+
15
+ assert !project.nil?
16
+ assert project.is_a?(Peaty::Project)
17
+ assert_equal PROJECT_ID, project.id
18
+ end
19
+
20
+ def test_user_can_fetch_all_projects
21
+ assert !@user.pivotal_tracker_projects.all.empty?
22
+ assert @user.pivotal_tracker_projects.all.first.is_a?(Peaty::Project)
23
+ end
24
+
25
+ # Tests for Users
26
+ def test_user_can_fetch_all_users_for_a_project
27
+ project = @user.pivotal_tracker_projects.find(PROJECT_ID)
28
+ assert !project.users.empty?
29
+ # users include the account that created the project
30
+ assert user = project.users.detect{ |u| u.name == project.account }
31
+ assert_equal project.account, user.name
32
+ end
33
+
34
+ # Tests for Stories
35
+ def test_user_can_fetch_all_stories_for_a_project
36
+ assert !@user.pivotal_tracker_projects.find(PROJECT_ID).stories.all.empty?
37
+ assert_equal PROJECT_ID, @user.pivotal_tracker_projects.find(PROJECT_ID).stories.first.project.id
38
+ end
39
+
40
+ def test_user_can_fetch_all_releases_for_a_project
41
+ assert !@user.pivotal_tracker_projects.find(PROJECT_ID).releases.all.empty?
42
+ assert_equal PROJECT_ID, @user.pivotal_tracker_projects.find(PROJECT_ID).releases.first.project.id
43
+ end
44
+
45
+ def test_user_can_fetch_all_releases_for_a_project_including_accepted_for_the_current_iteration
46
+ releases = @user.pivotal_tracker_projects.find(PROJECT_ID).releases.all
47
+ assert !releases.empty?
48
+ assert_equal PROJECT_ID, releases.first.project.id
49
+ assert_equal "accepted", releases.first.current_state
50
+ end
51
+
52
+ def test_user_can_fetch_all_stories_for_a_project_even_from_previous_iterations
53
+ project = @user.pivotal_tracker_projects.find(PROJECT_ID)
54
+ stories = project.stories.all(:includedone => true)
55
+ assert !stories.empty?
56
+ assert stories.size > project.stories.all.size # exclude done
57
+
58
+ story = stories.first
59
+ assert_equal PROJECT_ID, story.project.id
60
+ assert_equal "accepted", story.current_state
61
+
62
+ done = project.iterations.find(:done)
63
+ assert done.stories.any?{ |s| s.id == story.id }
64
+ end
65
+
66
+ def test_user_can_fetch_all_releases_for_a_project_via_stories
67
+ assert !@user.pivotal_tracker_projects.find(PROJECT_ID).stories(:type => :release).all.empty?
68
+ assert_equal :release, @user.pivotal_tracker_projects.find(PROJECT_ID).releases.first.story_type
69
+ end
70
+
71
+ def test_user_can_fetch_all_bugs_for_a_project_via_stories
72
+ assert !@user.pivotal_tracker_projects.find(PROJECT_ID).stories(:type => :bug).all.empty?
73
+ assert_equal :bug, @user.pivotal_tracker_projects.find(PROJECT_ID).bugs.first.story_type
74
+ end
75
+
76
+ def test_user_can_fetch_all_chores_for_a_project_via_stories
77
+ assert !@user.pivotal_tracker_projects.find(PROJECT_ID).stories(:type => :chore).all.empty?
78
+ assert_equal :chore, @user.pivotal_tracker_projects.find(PROJECT_ID).chores.first.story_type
79
+ end
80
+
81
+ # Tests for Iterations
82
+ def test_user_can_fetch_a_projects_iterations
83
+ project = @user.pivotal_tracker_projects.find(PROJECT_ID)
84
+ assert !project.iterations.all.empty?
85
+ assert iteration = project.iterations.first
86
+ assert !iteration.stories.empty?
87
+ assert_equal project.id, iteration.stories.first.project.id
88
+ end
89
+
90
+ end
@@ -0,0 +1,38 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+
4
+
5
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'peaty')
6
+
7
+ require 'test/unit'
8
+
9
+ require 'fakeweb'
10
+ FakeWeb.allow_net_connect = false
11
+
12
+ TEST_TOKEN = "test"
13
+
14
+ # USER_ID = 399324
15
+ PROJECT_ID = 153937
16
+ STORY_ID = 6821071
17
+ RELEASE_ID = 6821121
18
+
19
+ uri = "http://www.pivotaltracker.com/services/v3"
20
+ { "/projects" => "projects",
21
+ "/projects/#{PROJECT_ID}" => "project",
22
+ "/projects/#{PROJECT_ID}/stories" => "stories",
23
+ "/projects/#{PROJECT_ID}/iterations" => "iterations",
24
+ "/projects/#{PROJECT_ID}/iterations/done" => "iterations_done",
25
+ "/projects/#{PROJECT_ID}/stories/#{STORY_ID}" => "story",
26
+ "/projects/#{PROJECT_ID}/stories?filter=type%3Afeature" => "features",
27
+ "/projects/#{PROJECT_ID}/stories?filter=type%3Arelease" => "releases",
28
+ "/projects/#{PROJECT_ID}/stories/#{RELEASE_ID}" => "release",
29
+ "/projects/#{PROJECT_ID}/stories?filter=type%3Achore" => "chores",
30
+ "/projects/#{PROJECT_ID}/stories?filter=type%3Abug" => "bugs",
31
+ "/projects/#{PROJECT_ID}/stories?filter=includedone%3Atrue" => "stories_with_done",
32
+ }.each do |(path, fixture)|
33
+ FakeWeb.register_uri(:get, uri + path, :body => File.read(File.join(File.dirname(__FILE__), "fixtures", "%s.xml" % fixture)))
34
+ end
35
+
36
+ class User < Struct.new(:pivotal_tracker_api_key)
37
+ pivotal_tracker_for :pivotal_tracker_api_key
38
+ end