teamcity-ruby-client 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG.md +15 -1
- data/README.md +4 -2
- data/lib/teamcity.rb +1 -0
- data/lib/teamcity/client/build_types.rb +25 -16
- data/lib/teamcity/client/builds.rb +19 -15
- data/lib/teamcity/client/common.rb +0 -12
- data/lib/teamcity/client/projects.rb +21 -17
- data/lib/teamcity/client/vcs_roots.rb +11 -13
- data/lib/teamcity/configuration.rb +1 -5
- data/lib/teamcity/connection.rb +7 -7
- data/lib/teamcity/headers.rb +47 -0
- data/lib/teamcity/request.rb +2 -8
- data/lib/teamcity/version.rb +1 -1
- data/spec/cassettes/BuildTypes/DELETE/_delete_agent_requirement/should_delete_the_agent_requirement.yml +51 -6
- data/spec/cassettes/BuildTypes/DELETE/_delete_buildtype/should_delete_a_buildtype.yml +8 -6
- data/spec/cassettes/BuildTypes/DELETE/_delete_buildtype_parameter/should_delete_a_buildtype_parameter.yml +49 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype/should_fetch_the_details_of_a_buildtype_by_id.yml +51 -11
- data/spec/cassettes/BuildTypes/GET/_buildtype/should_raise_an_error_if_the_buildtype_does_not_exist.yml +8 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_fetch_the_build_configuration_agent_requirements_for_a_buildtype.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_return_an_array.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_return_nil_if_there_are_no_agent_requirements_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_fetch_the_build_configuration_artifact_dependencies_for_a_buildtype.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_return_an_array.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_return_nil_if_there_are_no_artifact_dependencies_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_fetch_the_build_configuration_features_for_a_buildtype.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_return_an_array.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_return_nil_if_there_are_no_features_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_investigations/should_get_investigation_details.yml +11 -11
- data/spec/cassettes/BuildTypes/GET/_buildtype_investigations/should_return_nil_if_no_one_is_investigating.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_fetch_the_build_configuration_parameters_for_a_buildtype.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_return_an_array.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_return_nil_if_there_are_no_parameters_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_settings/should_fetch_the_settings_for_a_given_buildtype.yml +51 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype_settings/should_return_an_array.yml +51 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_fetch_the_build_configuration_snapshot_dependencies_for_a_buildtype.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_return_an_array.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_return_nil_if_there_are_no_snapshot_dependencies_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_state/should_fetch_the_state_of_the_buildtype.yml +89 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_fetch_the_build_configuration_steps_for_a_buildtype.yml +10 -9
- data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_return_an_array.yml +9 -9
- data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_return_nil_if_there_are_no_steps_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_return_nil_if_the_buildtype_is_not_associated_with_a_template.yml +8 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_return_the_attributes_of_the_associated_template.yml +9 -8
- data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_fetch_the_build_configuration_triggers_for_a_buildtype.yml +8 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_return_an_array.yml +8 -6
- data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_return_nil_if_there_are_no_triggers_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_fetch_the_build_configuration_vcs_root_entries_for_a_buildtype.yml +10 -8
- data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_return_an_array.yml +10 -8
- data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_return_nil_if_there_are_no_vcs_root_entries_defined.yml +9 -7
- data/spec/cassettes/BuildTypes/GET/_buildtypes/should_fetch_all_the_buildtypes.yml +9 -12
- data/spec/cassettes/BuildTypes/POST/_attach_vcs_root/should_attach_a_vcs_root_to_a_buildtype.yml +9 -9
- data/spec/cassettes/BuildTypes/POST/_create_agent_requirement/should_create_an_agent_requirement_for_a_buildtype.yml +10 -9
- data/spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_disable_a_build_step.yml +14 -10
- data/spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_enable_a_build_step.yml +18 -10
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_pause_a_project.yml +14 -10
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_a_projects_description.yml +15 -11
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_the_buildtype_name.yml +15 -11
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_parameter/should_set_a_buildtype_parameter.yml +15 -11
- data/spec/cassettes/Builds/DELETE/_unpin_build/should_unpin_a_build.yml +51 -6
- data/spec/cassettes/Builds/GET/_build/should_fetch_the_build_details.yml +53 -11
- data/spec/cassettes/Builds/GET/_build/should_raise_an_error_if_the_build_does_not_exist.yml +16 -13
- data/spec/cassettes/Builds/GET/_build_pinned_/should_return_false_when_a_build_is_not_pinned.yml +126 -0
- data/spec/cassettes/Builds/GET/_build_pinned_/should_return_true_when_a_build_is_pinned.yml +126 -0
- data/spec/cassettes/Builds/GET/_build_statistics/should_return_statistics_for_a_build.yml +50 -5
- data/spec/cassettes/Builds/GET/_build_tags/should_fetch_the_build_tags.yml +51 -6
- data/spec/cassettes/Builds/GET/_build_tags/should_return_an_empty_array_if_there_are_no_build_tags_defined_for_a_build.yml +89 -0
- data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_filter_by_multiple_build_locators.yml +9 -7
- data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_filter_results_by_build_locators.yml +9 -7
- data/spec/cassettes/Builds/GET/_builds/should_fetch_all_the_builds.yml +9 -7
- data/spec/cassettes/Builds/GET/{_build_statistics/should_return_an_empty_string_for_a_build_with_no_statistics.yml → _builds/should_return_an_empty_array_if_no_results_are_found.yml} +9 -7
- data/spec/cassettes/Builds/PUT/_pin_build/should_pin_a_build.yml +49 -6
- data/spec/cassettes/Projects/DELETE/_delete_project/should_delete_a_project.yml +17 -14
- data/spec/cassettes/Projects/DELETE/_delete_project_parameter/should_delete_a_project_parameter.yml +91 -6
- data/spec/cassettes/Projects/GET/_project/should_fetch_a_single_project_by_id.yml +10 -10
- data/spec/cassettes/Projects/GET/_project/should_raise_an_error_if_the_project_does_not_exist.yml +9 -7
- data/spec/cassettes/Projects/GET/_project_buildtypes/should_fetch_all_the_buildTypes_for_a_project.yml +9 -8
- data/spec/cassettes/Projects/GET/{_projects/should_return_nil_if_there_are_no_projects.yml → _project_buildtypes/should_return_nil_if_the_project_does_not_have_any_build_types.yml} +9 -7
- data/spec/cassettes/Projects/GET/_project_parameters/should_fetch_all_the_paramters_for_a_given_project.yml +9 -7
- data/spec/cassettes/Projects/GET/_project_parameters/should_return_nil_if_there_are_no_parameters_defined_for_a_project.yml +9 -7
- data/spec/cassettes/Projects/GET/_projects/should_fetch_projects.yml +9 -9
- data/spec/cassettes/Projects/POST/_copy_project/should_copy_a_project.yml +61 -15
- data/spec/cassettes/Projects/POST/_create_project/should_create_a_project.yml +9 -8
- data/spec/cassettes/Projects/PUT/_set_project_field/should_archive_a_project.yml +56 -10
- data/spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_description.yml +56 -10
- data/spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_name.yml +56 -10
- data/spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter.yml +56 -10
- data/spec/cassettes/VCSRoots/GET/_vcs_root_details/should_fetch_the_vcs_root_details.yml +53 -6
- data/spec/cassettes/VCSRoots/GET/_vcs_roots/should_fetch_vcs_roots.yml +10 -7
- data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_vcs_root_that_is_shared_with_the_project_and_sub-projects.yml +90 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/teamcity/api_spec.rb +0 -1
- data/spec/teamcity/client/builds_spec.rb +36 -56
- data/spec/teamcity/client/buildtypes_spec.rb +78 -42
- data/spec/teamcity/client/projects_spec.rb +41 -32
- data/spec/teamcity/client/vcs_roots_spec.rb +9 -29
- data/spec/teamcity/client_spec.rb +5 -1
- data/spec/teamcity/headers_spec.rb +43 -0
- data/spec/teamcity_spec.rb +1 -28
- data/teamcity-ruby-client.gemspec +1 -0
- metadata +21 -23
- data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_raise_an_exception_if_the_response_is_not_due_to_a_template_not_assigned.yml +0 -50
- data/spec/cassettes/Builds/GET/_build_tags/should_return_nil_if_there_are_no_build_tags_defined_for_a_build.yml +0 -44
- data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_search_by_locator.yml +0 -44
- data/spec/cassettes/Projects/GET/_project_buildtypes/should_return_nil_if_the_project_does_not_have_any_build_build_types.yml +0 -44
- data/spec/cassettes/Projects/PUT/_set_project_field/should_un-archive_a_project.yml +0 -50
- data/spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter_with_a_boolean_value.yml +0 -40
- data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_shared_vcs_root.yml +0 -45
- data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_vcs_root_that_is_only_shared_within_a_project.yml +0 -48
@@ -13,28 +13,25 @@ describe 'BuildTypes' do
|
|
13
13
|
# Get requests
|
14
14
|
describe 'GET', :vcr do
|
15
15
|
|
16
|
-
before(:
|
16
|
+
before(:each) do
|
17
|
+
TeamCity.reset
|
17
18
|
TeamCity.configure do |config|
|
18
|
-
config.endpoint = 'http://localhost:8111/guestAuth/app/rest
|
19
|
+
config.endpoint = 'http://localhost:8111/guestAuth/app/rest'
|
19
20
|
end
|
20
|
-
end
|
21
|
-
|
22
|
-
before(:each) do
|
23
21
|
@tc = TeamCity
|
24
22
|
end
|
25
23
|
|
26
24
|
describe '.buildtypes' do
|
27
|
-
|
28
25
|
it 'should fetch all the buildtypes' do
|
29
|
-
@tc.buildtypes
|
26
|
+
build_types = @tc.buildtypes
|
27
|
+
build_types.should_not be_empty
|
30
28
|
end
|
31
|
-
|
32
29
|
end
|
33
30
|
|
34
31
|
describe '.buildtype' do
|
35
|
-
|
36
32
|
it 'should fetch the details of a buildtype by id' do
|
37
|
-
@tc.
|
33
|
+
build_type = @tc.buildtypes[0]
|
34
|
+
@tc.buildtype(id: build_type.id).id.should_not be_empty
|
38
35
|
end
|
39
36
|
|
40
37
|
it 'should raise an error if the buildtype does not exist' do
|
@@ -48,32 +45,33 @@ describe 'BuildTypes' do
|
|
48
45
|
|
49
46
|
describe '.buildtype_state' do
|
50
47
|
it 'should fetch the state of the buildtype' do
|
51
|
-
|
52
|
-
@tc.buildtype_state(id: '
|
48
|
+
build_type = @tc.buildtypes[0]
|
49
|
+
@tc.buildtype_state(id: build_type.id).should eq('false')
|
53
50
|
end
|
54
51
|
end
|
55
52
|
|
56
53
|
describe '.buildtype_settings' do
|
54
|
+
|
55
|
+
before(:each) do
|
56
|
+
@build_type = @tc.buildtypes[0]
|
57
|
+
end
|
58
|
+
|
57
59
|
it 'should fetch the settings for a given buildtype' do
|
58
|
-
@tc.buildtype_settings(id:
|
60
|
+
@tc.buildtype_settings(id: @build_type.id).should_not be_empty
|
59
61
|
end
|
60
62
|
|
61
63
|
it 'should return an array' do
|
62
|
-
@tc.buildtype_settings(id:
|
64
|
+
@tc.buildtype_settings(id: @build_type.id).should be_kind_of(Array)
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
66
68
|
describe '.buildtype_template' do
|
67
69
|
it 'should return the attributes of the associated template' do
|
68
|
-
@tc.buildtype_template(id: '
|
70
|
+
@tc.buildtype_template(id: 'BuildTypeTests_BuildTypeWithTemplate').id.should_not be_nil
|
69
71
|
end
|
70
72
|
|
71
73
|
it 'should return nil if the buildtype is not associated with a template' do
|
72
|
-
@tc.buildtype_template(id: '
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should raise an exception if the response is not due to a template not assigned' do
|
76
|
-
expect { @tc.buildtype_template(id: 'bt500').should be_nil }.to raise_error
|
74
|
+
@tc.buildtype_template(id: 'BuildTypeTests_BuildTypeWithNoTemplate').should be_nil
|
77
75
|
end
|
78
76
|
end
|
79
77
|
|
@@ -91,33 +89,35 @@ describe 'BuildTypes' do
|
|
91
89
|
|
92
90
|
before(:each) do
|
93
91
|
@method_name = "buildtype_#{type}"
|
92
|
+
@buildtype_id_with_settings = 'BuildTypeTests_GetBuildTypeConfigTests'
|
93
|
+
@buildtype_id_with_no_settings = 'BuildTypeTests_GetBuildTypeEmptyConfigTests'
|
94
94
|
end
|
95
95
|
|
96
|
-
|
97
|
-
@tc.send(@method_name, id:
|
96
|
+
it "should fetch the build configuration #{type} for a buildtype" do
|
97
|
+
@tc.send(@method_name, id: @buildtype_id_with_settings).should have_at_least(1).items
|
98
98
|
end
|
99
99
|
|
100
100
|
it 'should return an array' do
|
101
|
-
@tc.send(@method_name, id:
|
101
|
+
@tc.send(@method_name, id: @buildtype_id_with_settings).should be_kind_of(Array)
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should return nil if there are no #{type} defined" do
|
105
|
-
@tc.send(@method_name, id:
|
105
|
+
@tc.send(@method_name, id: @buildtype_id_with_no_settings).should be_empty
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
110
|
describe '.buildtype_investigations' do
|
111
|
-
before(:
|
111
|
+
before(:each) do
|
112
112
|
configure_client_with_authentication
|
113
113
|
end
|
114
114
|
|
115
115
|
it 'should get investigation details' do
|
116
|
-
@tc.buildtype_investigations('
|
116
|
+
@tc.buildtype_investigations('BuildTypeTests_GetBuildTypeWithInvestigations').should_not be_empty
|
117
117
|
end
|
118
118
|
|
119
119
|
it 'should return nil if no one is investigating' do
|
120
|
-
@tc.buildtype_investigations('
|
120
|
+
@tc.buildtype_investigations('BuildTypeTests_GetBuildTypeWithNoInvestigations').should be_empty
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
@@ -130,31 +130,54 @@ describe 'BuildTypes' do
|
|
130
130
|
|
131
131
|
describe '.set_buildtype_parameter' do
|
132
132
|
it 'should set a buildtype parameter' do
|
133
|
-
|
133
|
+
buildtype_id = 'BuildTypeTests_PutSetBuildTypeParameters'
|
134
|
+
param_name = 'test-setting-buildtype-parameters'
|
135
|
+
param_value = 'param-value'
|
136
|
+
@tc.set_buildtype_parameter(buildtype_id, param_name, param_value).should eq(param_value)
|
134
137
|
end
|
135
138
|
end
|
136
139
|
|
137
140
|
describe '.set_buildtype_field' do
|
141
|
+
|
142
|
+
before(:each) do
|
143
|
+
@buildtype_id = 'BuildTypeTests_PutSetBuildTypeField'
|
144
|
+
end
|
145
|
+
|
138
146
|
it 'should set the buildtype name' do
|
139
|
-
|
147
|
+
field_name = 'name'
|
148
|
+
field_value = 'PutSetBuildTypeField_Name_Changed_By_Test'
|
149
|
+
@tc.set_buildtype_field(@buildtype_id, field_name, field_value).should eq(field_value)
|
140
150
|
end
|
141
151
|
|
142
152
|
it 'should set a projects description' do
|
143
|
-
|
153
|
+
field_name = 'description'
|
154
|
+
field_value = 'description-set_buildtype_field'
|
155
|
+
@tc.set_buildtype_field(@buildtype_id, field_name, field_value).should eq(field_value)
|
144
156
|
end
|
145
157
|
|
146
158
|
it 'should pause a project' do
|
147
|
-
|
159
|
+
field_name = 'paused'
|
160
|
+
field_value = 'true'
|
161
|
+
@tc.set_buildtype_field(@buildtype_id, field_name, field_value).should eq(field_value)
|
148
162
|
end
|
149
163
|
end
|
150
164
|
|
151
165
|
describe '.set_build_step_field' do
|
166
|
+
before(:each) do
|
167
|
+
@buildtype_id = 'BuildTypeTests_PutSetBuildStepField'
|
168
|
+
@build_step_id = 'RUNNER_7'
|
169
|
+
end
|
170
|
+
|
152
171
|
it 'should disable a build step' do
|
153
|
-
|
172
|
+
field_name = 'disabled'
|
173
|
+
field_value = 'true'
|
174
|
+
@tc.set_build_step_field(@buildtype_id, @build_step_id, field_name, field_value)
|
154
175
|
end
|
155
176
|
|
156
177
|
it 'should enable a build step' do
|
157
|
-
|
178
|
+
field_name = 'disabled'
|
179
|
+
field_value = 'false'
|
180
|
+
@tc.set_build_step_field(@build_type_id, @build_step_id, field_name, field_value)
|
158
181
|
end
|
159
182
|
end
|
160
183
|
end
|
@@ -164,21 +187,25 @@ describe 'BuildTypes' do
|
|
164
187
|
configure_client_with_authentication
|
165
188
|
end
|
166
189
|
|
190
|
+
before(:each) do
|
191
|
+
@buildtype_id = 'BuildTypeTests_PostBuildTypeTests'
|
192
|
+
end
|
193
|
+
|
167
194
|
describe '.attach_vcs_root' do
|
168
195
|
it 'should attach a vcs root to a buildtype' do
|
169
|
-
|
196
|
+
vcs_root_id = 'teamcity_ruby_client'
|
197
|
+
@tc.attach_vcs_root(@buildtype_id, vcs_root_id).id.should eq(vcs_root_id)
|
170
198
|
end
|
171
199
|
end
|
172
200
|
|
173
201
|
describe '.create_agent_requirement' do
|
174
202
|
it 'should create an agent requirement for a buildtype' do
|
175
|
-
|
176
|
-
|
177
|
-
parameter_value = 'test'
|
203
|
+
parameter_name = 'post-agent-requirement-name'
|
204
|
+
parameter_value = 'post-agent-requirement-value'
|
178
205
|
condition = 'equals'
|
179
|
-
args = [buildtype_id, parameter_name, parameter_value, condition]
|
206
|
+
args = [@buildtype_id, parameter_name, parameter_value, condition]
|
180
207
|
response = @tc.create_agent_requirement(*args)
|
181
|
-
response.id.should eq(
|
208
|
+
response.id.should eq(parameter_name)
|
182
209
|
end
|
183
210
|
end
|
184
211
|
end
|
@@ -188,21 +215,30 @@ describe 'BuildTypes' do
|
|
188
215
|
configure_client_with_authentication
|
189
216
|
end
|
190
217
|
|
218
|
+
before(:each) do
|
219
|
+
@buildtype_id = 'BuildTypeTests_DeleteBuildTypeSettings'
|
220
|
+
end
|
221
|
+
|
191
222
|
describe '.delete_buildtype_parameter' do
|
192
223
|
it 'should delete a buildtype parameter' do
|
193
|
-
|
224
|
+
param_to_delete = 'delete-buildtype-param'
|
225
|
+
@tc.set_buildtype_parameter(@buildtype_id, param_to_delete, '')
|
226
|
+
@tc.delete_buildtype_parameter(@buildtype_id, 'delete-me').should be_nil
|
194
227
|
end
|
195
228
|
end
|
196
229
|
|
197
230
|
describe '.delete_agent_requirement' do
|
198
231
|
it 'should delete the agent requirement' do
|
199
|
-
|
232
|
+
agent_requirement_to_delete = 'delete-agent-requirement'
|
233
|
+
@tc.create_agent_requirement(@buildtype_id, agent_requirement_to_delete, '', 'equals')
|
234
|
+
@tc.delete_agent_requirement(@buildtype_id, agent_requirement_to_delete).should be_nil
|
200
235
|
end
|
201
236
|
end
|
202
237
|
|
203
238
|
describe '.delete_buildtype' do
|
204
239
|
it 'should delete a buildtype' do
|
205
|
-
|
240
|
+
project_id_to_delete = 'BuildTypeTests_DeleteBuildTypeRequest'
|
241
|
+
@tc.delete_buildtype(project_id_to_delete).should be_nil
|
206
242
|
end
|
207
243
|
end
|
208
244
|
end
|
@@ -15,7 +15,7 @@ describe 'Projects' do
|
|
15
15
|
|
16
16
|
before(:all) do
|
17
17
|
TeamCity.configure do |config|
|
18
|
-
config.endpoint = 'http://localhost:8111/guestAuth/app/rest
|
18
|
+
config.endpoint = 'http://localhost:8111/guestAuth/app/rest'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -24,20 +24,15 @@ describe 'Projects' do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
describe '.projects' do
|
27
|
-
|
28
27
|
it 'should fetch projects' do
|
29
28
|
@tc.projects.should_not be_nil
|
30
29
|
end
|
31
|
-
|
32
|
-
it 'should return nil if there are no projects' do
|
33
|
-
@tc.projects.should be_nil
|
34
|
-
end
|
35
30
|
end
|
36
31
|
|
37
32
|
describe '.project' do
|
38
33
|
|
39
34
|
it 'should fetch a single project by id' do
|
40
|
-
@tc.project(id: '
|
35
|
+
@tc.project(id: 'GetProjectRequest').should_not be_nil
|
41
36
|
end
|
42
37
|
|
43
38
|
it 'should raise an error if the project does not exist' do
|
@@ -52,27 +47,27 @@ describe 'Projects' do
|
|
52
47
|
describe '.project_buildtypes' do
|
53
48
|
|
54
49
|
it 'should fetch all the buildTypes for a project' do
|
55
|
-
bts = @tc.project_buildtypes(id: '
|
50
|
+
bts = @tc.project_buildtypes(id: 'GetProjectBuildTypes')
|
56
51
|
bts.each do |bt|
|
57
|
-
bt.projectId.should eq('
|
52
|
+
bt.projectId.should eq('GetProjectBuildTypes')
|
58
53
|
end
|
59
54
|
end
|
60
55
|
|
61
|
-
it 'should return nil if the project does not have any build
|
62
|
-
bts = @tc.project_buildtypes(id: '
|
63
|
-
bts.should
|
56
|
+
it 'should return nil if the project does not have any build types' do
|
57
|
+
bts = @tc.project_buildtypes(id: 'GetProjectWithNoBuildTypes')
|
58
|
+
bts.should be_empty
|
64
59
|
end
|
65
60
|
end
|
66
61
|
|
67
62
|
describe '.project_parameters' do
|
68
63
|
it 'should fetch all the paramters for a given project' do
|
69
|
-
parameters = @tc.project_parameters(id: '
|
70
|
-
parameters.size.
|
64
|
+
parameters = @tc.project_parameters(id: 'GetProjectWithParameters')
|
65
|
+
parameters.size.should_not eq(0)
|
71
66
|
end
|
72
67
|
|
73
68
|
it 'should return nil if there are no parameters defined for a project' do
|
74
|
-
parameters = @tc.project_parameters(id: '
|
75
|
-
parameters.should
|
69
|
+
parameters = @tc.project_parameters(id: 'GetProjectWithNoParameters')
|
70
|
+
parameters.should be_empty
|
76
71
|
end
|
77
72
|
|
78
73
|
it 'should raise an error if the project does not exist' do
|
@@ -90,20 +85,20 @@ describe 'Projects' do
|
|
90
85
|
|
91
86
|
describe '.create_project' do
|
92
87
|
it 'should create a project' do
|
93
|
-
response = @tc.create_project('
|
94
|
-
response.id.should
|
88
|
+
response = @tc.create_project('PostCreateProject')
|
89
|
+
response.id.should eq('PostCreateProject')
|
95
90
|
end
|
96
91
|
end
|
97
92
|
|
98
93
|
describe '.copy_project' do
|
99
94
|
it 'should copy a project' do
|
100
|
-
|
101
|
-
|
95
|
+
@tc.create_project('PostProjectToBeCopied')
|
96
|
+
source_project = @tc.project(id: 'PostProjectToBeCopied')
|
97
|
+
copied_project_name = 'PostCopyProject'
|
102
98
|
response = @tc.copy_project(
|
103
99
|
source_project.id,
|
104
100
|
copied_project_name,
|
105
|
-
:copyAllAssociatedSettings => true
|
106
|
-
:shareVCSRoots => true
|
101
|
+
:copyAllAssociatedSettings => true
|
107
102
|
)
|
108
103
|
response.name.should eq(copied_project_name)
|
109
104
|
end
|
@@ -118,14 +113,18 @@ describe 'Projects' do
|
|
118
113
|
|
119
114
|
describe '.delete_project' do
|
120
115
|
it 'should delete a project' do
|
121
|
-
response = @tc.create_project('
|
116
|
+
response = @tc.create_project('ProjectToDelete')
|
122
117
|
@tc.delete_project(response.id).should be_nil
|
123
118
|
end
|
124
119
|
end
|
125
120
|
|
126
121
|
describe '.delete_project_parameter' do
|
127
122
|
it 'should delete a project parameter' do
|
128
|
-
|
123
|
+
project_id = 'DeleteProjectParameters'
|
124
|
+
param_to_delete = 'delete-this-param'
|
125
|
+
@tc.create_project(project_id)
|
126
|
+
@tc.set_project_parameter(project_id, param_to_delete, 'delete-me')
|
127
|
+
response = @tc.delete_project_parameter(project_id, param_to_delete)
|
129
128
|
response.should be_nil
|
130
129
|
end
|
131
130
|
end
|
@@ -139,25 +138,35 @@ describe 'Projects' do
|
|
139
138
|
|
140
139
|
describe '.set_project_parameter' do
|
141
140
|
it 'should set a project parameter' do
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
@tc.set_project_parameter(
|
141
|
+
project_id = 'PutCreateProjectParam'
|
142
|
+
param_name = 'set-with-param'
|
143
|
+
param_value = 'some-value'
|
144
|
+
@tc.create_project(project_id)
|
145
|
+
@tc.set_project_parameter(project_id, param_name, param_value).should eq(param_value)
|
147
146
|
end
|
148
147
|
end
|
149
148
|
|
150
149
|
describe '.set_project_field' do
|
150
|
+
|
151
151
|
it 'should set a projects name' do
|
152
|
-
|
152
|
+
project_id = 'PutSetProjectNameField'
|
153
|
+
@tc.create_project(project_id)
|
154
|
+
field_value = 'PutNewProjectName'
|
155
|
+
@tc.set_project_field(project_id, 'name', field_value).should eq(field_value)
|
153
156
|
end
|
154
157
|
|
155
158
|
it 'should set a projects description' do
|
156
|
-
|
159
|
+
project_id = 'PutSetProjectDescriptionField'
|
160
|
+
@tc.create_project(project_id)
|
161
|
+
field_value = 'description-changed-by-test'
|
162
|
+
@tc.set_project_field(project_id, 'description', field_value).should eq(field_value)
|
157
163
|
end
|
158
164
|
|
159
165
|
it 'should archive a project' do
|
160
|
-
|
166
|
+
project_id = 'PutSetProjectArchiveField'
|
167
|
+
@tc.create_project(project_id)
|
168
|
+
field_value = 'true'
|
169
|
+
@tc.set_project_field(project_id, 'archived', field_value).should eq(field_value)
|
161
170
|
end
|
162
171
|
end
|
163
172
|
end
|
@@ -4,44 +4,33 @@ describe 'VCSRoots' do
|
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
@tc = TeamCity
|
7
|
-
|
8
|
-
|
9
|
-
before(:all) do
|
10
|
-
TeamCity.configure do |config|
|
11
|
-
configure_client_with_authentication
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
after(:all) do
|
16
|
-
TeamCity.reset
|
7
|
+
configure_client_with_authentication
|
17
8
|
end
|
18
9
|
|
19
10
|
# GET requests
|
20
11
|
describe 'GET', :vcr do
|
21
12
|
describe '.vcs_roots' do
|
22
|
-
|
23
13
|
it 'should fetch vcs roots' do
|
24
|
-
@tc.vcs_roots.
|
14
|
+
@tc.vcs_roots.should have_at_least(1).items
|
25
15
|
end
|
26
16
|
end
|
27
17
|
|
28
18
|
describe '.vcs_root_details' do
|
29
|
-
|
30
19
|
it 'should fetch the vcs root details' do
|
31
|
-
|
32
|
-
response.
|
20
|
+
vcs_root_id = @tc.vcs_roots.first.id
|
21
|
+
response = @tc.vcs_root_details(vcs_root_id)
|
22
|
+
response.id.should eq(vcs_root_id)
|
33
23
|
end
|
34
24
|
end
|
35
25
|
end
|
36
26
|
|
37
27
|
describe 'POST', :vcr do
|
38
|
-
|
39
28
|
describe '.create_vcs_root' do
|
40
|
-
|
41
|
-
|
42
|
-
vcs_name = '
|
29
|
+
it 'should create a vcs root that is shared with the project and sub-projects' do
|
30
|
+
project_id = @tc.projects[1].id
|
31
|
+
vcs_name = 'PostCreateVCSRoot'
|
43
32
|
vcs_type = 'git'
|
44
|
-
response = @tc.create_vcs_root(vcs_name, vcs_type, :
|
33
|
+
response = @tc.create_vcs_root(vcs_name: vcs_name, vcs_type: vcs_type, project_id: project_id) do |properties|
|
45
34
|
properties['branch'] = 'master'
|
46
35
|
properties['url'] = 'git@github.com:jperry/teamcity-ruby-client.git'
|
47
36
|
properties['authMethod'] = 'PRIVATE_KEY_DEFAULT'
|
@@ -49,15 +38,6 @@ describe 'VCSRoots' do
|
|
49
38
|
end
|
50
39
|
response.name.should eq(vcs_name)
|
51
40
|
response.vcsName.should match(/#{vcs_type}/)
|
52
|
-
response.shared.should be_false
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'should create a shared vcs root' do
|
56
|
-
response = @tc.create_vcs_root('sharedvcsroot', 'git', :shared => true) do |properties|
|
57
|
-
properties['branch'] = 'master'
|
58
|
-
properties['url'] = 'git@github.com:jperry/teamcity-ruby-client.git'
|
59
|
-
end
|
60
|
-
response.shared.should be_true
|
61
41
|
end
|
62
42
|
end
|
63
43
|
end
|