teamcity 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.travis.yml +3 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +83 -0
- data/Gemfile +4 -0
- data/Guardfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +194 -0
- data/Rakefile +1 -0
- data/lib/faraday/null_response_body.rb +17 -0
- data/lib/teamcity.rb +26 -0
- data/lib/teamcity/api.rb +19 -0
- data/lib/teamcity/client.rb +16 -0
- data/lib/teamcity/client/build_types.rb +305 -0
- data/lib/teamcity/client/builds.rb +92 -0
- data/lib/teamcity/client/common.rb +23 -0
- data/lib/teamcity/client/projects.rb +159 -0
- data/lib/teamcity/client/tests.rb +24 -0
- data/lib/teamcity/client/vcs_roots.rb +70 -0
- data/lib/teamcity/configuration.rb +51 -0
- data/lib/teamcity/connection.rb +28 -0
- data/lib/teamcity/element_builder.rb +27 -0
- data/lib/teamcity/headers.rb +47 -0
- data/lib/teamcity/request.rb +35 -0
- data/lib/teamcity/version.rb +3 -0
- data/spec/cassettes/BuildTypes/DELETE/_delete_agent_requirement/should_delete_the_agent_requirement.yml +83 -0
- data/spec/cassettes/BuildTypes/DELETE/_delete_buildtype/should_delete_a_buildtype.yml +40 -0
- data/spec/cassettes/BuildTypes/DELETE/_delete_buildtype_parameter/should_delete_a_buildtype_parameter.yml +81 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype/should_fetch_the_details_of_a_buildtype_by_id.yml +89 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype/should_raise_an_error_if_the_buildtype_does_not_exist.yml +52 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_fetch_the_build_configuration_agent_requirements_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_return_nil_if_there_are_no_agent_requirements_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_fetch_the_build_configuration_artifact_dependencies_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_return_nil_if_there_are_no_artifact_dependencies_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_branches/should_fetch_vcs_branches_the_vcs_root_is_configured_to_use.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_fetch_the_build_configuration_features_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_return_nil_if_there_are_no_features_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_investigations/should_get_investigation_details.yml +48 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_investigations/should_return_nil_if_no_one_is_investigating.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_fetch_the_build_configuration_parameters_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_return_nil_if_there_are_no_parameters_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_settings/should_fetch_the_settings_for_a_given_buildtype.yml +89 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_settings/should_return_an_array.yml +89 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_fetch_the_build_configuration_snapshot_dependencies_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_return_nil_if_there_are_no_snapshot_dependencies_defined.yml +46 -0
- 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 +47 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_return_nil_if_there_are_no_steps_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_return_nil_if_the_buildtype_is_not_associated_with_a_template.yml +52 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_return_the_attributes_of_the_associated_template.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_fetch_the_build_configuration_triggers_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_return_an_array.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_return_nil_if_there_are_no_triggers_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_fetch_the_build_configuration_vcs_root_entries_for_a_buildtype.yml +47 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_return_an_array.yml +47 -0
- data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_return_nil_if_there_are_no_vcs_root_entries_defined.yml +46 -0
- data/spec/cassettes/BuildTypes/GET/_buildtypes/should_fetch_all_the_buildtypes.yml +46 -0
- data/spec/cassettes/BuildTypes/POST/_attach_vcs_root/should_attach_a_vcs_root_to_a_buildtype.yml +47 -0
- data/spec/cassettes/BuildTypes/POST/_create_agent_requirement/should_create_an_agent_requirement_for_a_buildtype.yml +46 -0
- data/spec/cassettes/BuildTypes/POST/_create_build_step/should_create_a_build_step_for_a_given_build_type.yml +46 -0
- data/spec/cassettes/BuildTypes/POST/_create_build_trigger/should_create_a_build_trigger_for_a_given_build_type.yml +46 -0
- data/spec/cassettes/BuildTypes/POST/_create_buildtype/should_create_a_build_type.yml +86 -0
- data/spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_disable_a_build_step.yml +44 -0
- data/spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_enable_a_build_step.yml +48 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_pause_a_project.yml +44 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_a_projects_description.yml +44 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_the_buildtype_name.yml +44 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_parameter/should_set_a_buildtype_parameter.yml +44 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_setting/should_set_if_it_should_perform_clean_builds.yml +46 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_setting/should_set_what_is_the_timeout_in_minutes_when_executing_builds.yml +46 -0
- data/spec/cassettes/BuildTypes/PUT/_set_buildtype_setting/should_set_where_the_checkout_happens_when_building.yml +46 -0
- data/spec/cassettes/Builds/DELETE/_unpin_build/should_unpin_a_build.yml +83 -0
- data/spec/cassettes/Builds/GET/_build/should_fetch_the_build_details.yml +91 -0
- data/spec/cassettes/Builds/GET/_build/should_raise_an_error_if_the_build_does_not_exist.yml +53 -0
- data/spec/cassettes/Builds/GET/_build_artifacts/should_fetch_all_the_artifacts.yml +89 -0
- 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 +89 -0
- data/spec/cassettes/Builds/GET/_build_tags/should_fetch_the_build_tags.yml +89 -0
- 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 +46 -0
- data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_filter_results_by_build_locators.yml +46 -0
- data/spec/cassettes/Builds/GET/_builds/should_fetch_all_the_builds.yml +46 -0
- data/spec/cassettes/Builds/GET/_builds/should_return_an_empty_array_if_no_results_are_found.yml +46 -0
- data/spec/cassettes/Builds/PUT/_pin_build/should_pin_a_build.yml +83 -0
- data/spec/cassettes/Projects/DELETE/_delete_project/should_delete_a_project.yml +82 -0
- data/spec/cassettes/Projects/DELETE/_delete_project_parameter/should_delete_a_project_parameter.yml +123 -0
- data/spec/cassettes/Projects/GET/_parent_project/should_fetch_the_parent_project_for_a_given_project.yml +46 -0
- data/spec/cassettes/Projects/GET/_parent_project/should_return_nil_if_there_is_no_parent_project_for_a_given_project.yml +46 -0
- data/spec/cassettes/Projects/GET/_project/should_fetch_a_single_project_by_id.yml +47 -0
- data/spec/cassettes/Projects/GET/_project/should_raise_an_error_if_the_project_does_not_exist.yml +52 -0
- data/spec/cassettes/Projects/GET/_project_buildtypes/should_fetch_all_the_buildTypes_for_a_project.yml +46 -0
- data/spec/cassettes/Projects/GET/_project_buildtypes/should_return_nil_if_the_project_does_not_have_any_build_types.yml +46 -0
- data/spec/cassettes/Projects/GET/_project_parameters/should_fetch_all_the_paramters_for_a_given_project.yml +46 -0
- data/spec/cassettes/Projects/GET/_project_parameters/should_return_nil_if_there_are_no_parameters_defined_for_a_project.yml +46 -0
- data/spec/cassettes/Projects/GET/_projects/should_fetch_projects.yml +46 -0
- data/spec/cassettes/Projects/POST/_copy_project/should_copy_a_project.yml +135 -0
- data/spec/cassettes/Projects/POST/_create_project/should_create_a_project.yml +45 -0
- data/spec/cassettes/Projects/PUT/_set_parent_project/should_set_a_parent_project_for_a_given_project.yml +134 -0
- data/spec/cassettes/Projects/PUT/_set_project_field/should_archive_a_project.yml +86 -0
- data/spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_description.yml +86 -0
- data/spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_name.yml +86 -0
- data/spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter.yml +86 -0
- data/spec/cassettes/Tests/GET/_tests/should_allow_you_to_filter_by_test_id.yml +49 -0
- data/spec/cassettes/Tests/GET/_tests/should_allow_you_to_filter_results_by_test_count_locator.yml +55 -0
- data/spec/cassettes/Tests/GET/_tests/should_fetch_all_the_tests.yml +60 -0
- data/spec/cassettes/Tests/GET/_tests/should_return_an_empty_array_if_no_build_is_found.yml +51 -0
- data/spec/cassettes/Tests/GET/_tests/should_return_an_empty_array_if_no_test_is_found.yml +51 -0
- data/spec/cassettes/Tests/GET/_tests/should_return_an_empty_array_if_not_build_is_given.yml +51 -0
- data/spec/cassettes/VCSRoots/GET/_vcs_root_details/should_fetch_the_vcs_root_details.yml +91 -0
- data/spec/cassettes/VCSRoots/GET/_vcs_roots/should_fetch_vcs_roots.yml +47 -0
- data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_git_vcs_root_that_is_shared_with_the_project_and_sub-projects.yml +89 -0
- data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_subversion_vcs_root_that_is_shared_with_the_project_and_sub-projects.yml +89 -0
- data/spec/cassettes/VCSRoots/PUT/_set_vcs_root_field/should_set_a_vcs_modification_check_interval.yml +179 -0
- data/spec/faraday/null_response_body_spec.rb +18 -0
- data/spec/spec_helper.rb +22 -0
- data/spec/support/vcr_setup.rb +9 -0
- data/spec/teamcity/api_spec.rb +64 -0
- data/spec/teamcity/client/builds_spec.rb +113 -0
- data/spec/teamcity/client/buildtypes_spec.rb +308 -0
- data/spec/teamcity/client/projects_spec.rb +207 -0
- data/spec/teamcity/client/tests_spec.rb +47 -0
- data/spec/teamcity/client/vcs_roots_spec.rb +86 -0
- data/spec/teamcity/client_spec.rb +14 -0
- data/spec/teamcity/element_builder_spec.rb +30 -0
- data/spec/teamcity/headers_spec.rb +43 -0
- data/spec/teamcity/version_spec.rb +7 -0
- data/spec/teamcity_spec.rb +89 -0
- data/teamcity.gemspec +26 -0
- metadata +344 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- TeamCity Ruby Client 1.1.0
|
12
|
+
Accept:
|
13
|
+
- application/json; charset=utf-8
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
Set-Cookie:
|
26
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
27
|
+
- TCSESSIONID=F147E033D5D5198FA3940D6B9B747D2C; Path=/; HttpOnly
|
28
|
+
Pragma:
|
29
|
+
- no-cache
|
30
|
+
Expires:
|
31
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache
|
34
|
+
- no-store
|
35
|
+
Content-Type:
|
36
|
+
- application/json
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
Date:
|
40
|
+
- Wed, 27 Nov 2013 18:40:58 GMT
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"project":[{"id":"_Root","name":"<Root project>","href":"/httpAuth/app/rest/projects/id:_Root"},{"id":"Test","name":"Test","href":"/httpAuth/app/rest/projects/id:Test"}]}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Wed, 27 Nov 2013 18:40:58 GMT
|
46
|
+
- request:
|
47
|
+
method: post
|
48
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"name":"PostCreateVCSRootGit","vcsName":"jetbrains.git","projectLocator":"Test","properties":{"property":[{"name":"branch","value":"master"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"},{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"ignoreKnownHosts","value":true}]}}'
|
52
|
+
headers:
|
53
|
+
User-Agent:
|
54
|
+
- TeamCity Ruby Client 1.1.0
|
55
|
+
Accept:
|
56
|
+
- application/json; charset=utf-8
|
57
|
+
Content-Type:
|
58
|
+
- application/json
|
59
|
+
Accept-Encoding:
|
60
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
61
|
+
response:
|
62
|
+
status:
|
63
|
+
code: 200
|
64
|
+
message: OK
|
65
|
+
headers:
|
66
|
+
Server:
|
67
|
+
- Apache-Coyote/1.1
|
68
|
+
Set-Cookie:
|
69
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
70
|
+
- TCSESSIONID=76FC840763407D31E2FDE0A2D0887C99; Path=/; HttpOnly
|
71
|
+
Pragma:
|
72
|
+
- no-cache
|
73
|
+
Expires:
|
74
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
75
|
+
Cache-Control:
|
76
|
+
- no-cache
|
77
|
+
- no-store
|
78
|
+
Content-Type:
|
79
|
+
- application/json
|
80
|
+
Transfer-Encoding:
|
81
|
+
- chunked
|
82
|
+
Date:
|
83
|
+
- Wed, 27 Nov 2013 18:40:58 GMT
|
84
|
+
body:
|
85
|
+
encoding: UTF-8
|
86
|
+
string: '{"id":"Test_PostCreateVCSRootGit","name":"PostCreateVCSRootGit","vcsName":"jetbrains.git","status":"NOT_MONITORED","lastChecked":"20131127T175833+0000","href":"/httpAuth/app/rest/vcs-roots/id:Test_PostCreateVCSRootGit","project":{"id":"Test","name":"Test","href":"/httpAuth/app/rest/projects/id:Test"},"properties":{"property":[{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"branch","value":"master"},{"name":"ignoreKnownHosts","value":"true"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"}]},"vcsRootInstances":{"href":"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:Test_PostCreateVCSRootGit)"}}'
|
87
|
+
http_version:
|
88
|
+
recorded_at: Wed, 27 Nov 2013 18:40:58 GMT
|
89
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,89 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- TeamCity Ruby Client 1.1.0
|
12
|
+
Accept:
|
13
|
+
- application/json; charset=utf-8
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
Set-Cookie:
|
26
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
27
|
+
- TCSESSIONID=F01D48DDAF27463D115315F4B1E901E7; Path=/; HttpOnly
|
28
|
+
Pragma:
|
29
|
+
- no-cache
|
30
|
+
Expires:
|
31
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache
|
34
|
+
- no-store
|
35
|
+
Content-Type:
|
36
|
+
- application/json
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
Date:
|
40
|
+
- Wed, 27 Nov 2013 18:40:58 GMT
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"project":[{"id":"_Root","name":"<Root project>","href":"/httpAuth/app/rest/projects/id:_Root"},{"id":"Test","name":"Test","href":"/httpAuth/app/rest/projects/id:Test"}]}'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Wed, 27 Nov 2013 18:40:58 GMT
|
46
|
+
- request:
|
47
|
+
method: post
|
48
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
49
|
+
body:
|
50
|
+
encoding: UTF-8
|
51
|
+
string: '{"name":"PostCreateVCSRootSvn","vcsName":"svn","projectLocator":"Test","properties":{"property":[{"name":"branch","value":"master"},{"name":"url","value":"http://svn.example.com/jperry/teamcity-ruby-client"},{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"ignoreKnownHosts","value":true}]}}'
|
52
|
+
headers:
|
53
|
+
User-Agent:
|
54
|
+
- TeamCity Ruby Client 1.1.0
|
55
|
+
Accept:
|
56
|
+
- application/json; charset=utf-8
|
57
|
+
Content-Type:
|
58
|
+
- application/json
|
59
|
+
Accept-Encoding:
|
60
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
61
|
+
response:
|
62
|
+
status:
|
63
|
+
code: 200
|
64
|
+
message: OK
|
65
|
+
headers:
|
66
|
+
Server:
|
67
|
+
- Apache-Coyote/1.1
|
68
|
+
Set-Cookie:
|
69
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
70
|
+
- TCSESSIONID=07AA1D215198333F0FA172478327DA30; Path=/; HttpOnly
|
71
|
+
Pragma:
|
72
|
+
- no-cache
|
73
|
+
Expires:
|
74
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
75
|
+
Cache-Control:
|
76
|
+
- no-cache
|
77
|
+
- no-store
|
78
|
+
Content-Type:
|
79
|
+
- application/json
|
80
|
+
Transfer-Encoding:
|
81
|
+
- chunked
|
82
|
+
Date:
|
83
|
+
- Wed, 27 Nov 2013 18:40:58 GMT
|
84
|
+
body:
|
85
|
+
encoding: UTF-8
|
86
|
+
string: '{"id":"Test_PostCreateVCSRootSvn","name":"PostCreateVCSRootSvn","vcsName":"svn","status":"NOT_MONITORED","lastChecked":"20131127T175833+0000","href":"/httpAuth/app/rest/vcs-roots/id:Test_PostCreateVCSRootSvn","project":{"id":"Test","name":"Test","href":"/httpAuth/app/rest/projects/id:Test"},"properties":{"property":[{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"branch","value":"master"},{"name":"ignoreKnownHosts","value":"true"},{"name":"url","value":"http://svn.example.com/jperry/teamcity-ruby-client"}]},"vcsRootInstances":{"href":"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:Test_PostCreateVCSRootSvn)"}}'
|
87
|
+
http_version:
|
88
|
+
recorded_at: Wed, 27 Nov 2013 18:40:58 GMT
|
89
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,179 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- TeamCity Ruby Client 1.3.1
|
12
|
+
Accept:
|
13
|
+
- application/json; charset=utf-8
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Server:
|
24
|
+
- Apache-Coyote/1.1
|
25
|
+
Set-Cookie:
|
26
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
27
|
+
- TCSESSIONID=006265B3606DE5A1A023237D33A4309C; Path=/; HttpOnly
|
28
|
+
Pragma:
|
29
|
+
- no-cache
|
30
|
+
Expires:
|
31
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
32
|
+
Cache-Control:
|
33
|
+
- no-cache
|
34
|
+
- no-store
|
35
|
+
Content-Type:
|
36
|
+
- application/json
|
37
|
+
Transfer-Encoding:
|
38
|
+
- chunked
|
39
|
+
Date:
|
40
|
+
- Wed, 04 Mar 2015 20:50:42 GMT
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: '{"count":2,"project":[{"id":"_Root","name":"<Root project>","description":"Contains
|
44
|
+
all other projects","href":"/httpAuth/app/rest/projects/id:_Root","webUrl":"http://localhost:8111/project.html?projectId=_Root"},{"id":"TestProject","name":"Test
|
45
|
+
project","parentProjectId":"_Root","href":"/httpAuth/app/rest/projects/id:TestProject","webUrl":"http://localhost:8111/project.html?projectId=TestProject"}]}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Wed, 04 Mar 2015 20:50:42 GMT
|
48
|
+
- request:
|
49
|
+
method: post
|
50
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: '{"name":"PutSetCheckIntervalField","vcsName":"jetbrains.git","projectLocator":"TestProject","properties":{"property":[{"name":"branch","value":"master"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"},{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"ignoreKnownHosts","value":true}]}}'
|
54
|
+
headers:
|
55
|
+
User-Agent:
|
56
|
+
- TeamCity Ruby Client 1.3.1
|
57
|
+
Accept:
|
58
|
+
- application/json; charset=utf-8
|
59
|
+
Content-Type:
|
60
|
+
- application/json
|
61
|
+
Accept-Encoding:
|
62
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 200
|
66
|
+
message: OK
|
67
|
+
headers:
|
68
|
+
Server:
|
69
|
+
- Apache-Coyote/1.1
|
70
|
+
Set-Cookie:
|
71
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
72
|
+
- TCSESSIONID=B50DFB505842D20CF1A45B58B65EF603; Path=/; HttpOnly
|
73
|
+
Pragma:
|
74
|
+
- no-cache
|
75
|
+
Expires:
|
76
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
77
|
+
Cache-Control:
|
78
|
+
- no-cache
|
79
|
+
- no-store
|
80
|
+
Content-Type:
|
81
|
+
- application/json
|
82
|
+
Transfer-Encoding:
|
83
|
+
- chunked
|
84
|
+
Date:
|
85
|
+
- Wed, 04 Mar 2015 20:50:42 GMT
|
86
|
+
body:
|
87
|
+
encoding: UTF-8
|
88
|
+
string: '{"id":"TestProject_PutSetCheckIntervalField","name":"PutSetCheckIntervalField","vcsName":"jetbrains.git","status":"NOT_MONITORED","lastChecked":"20150305T090509+1300","href":"/httpAuth/app/rest/vcs-roots/id:TestProject_PutSetCheckIntervalField","project":{"id":"TestProject","name":"Test
|
89
|
+
project","parentProjectId":"_Root","href":"/httpAuth/app/rest/projects/id:TestProject","webUrl":"http://localhost:8111/project.html?projectId=TestProject"},"properties":{"property":[{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"branch","value":"master"},{"name":"ignoreKnownHosts","value":"true"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"}]},"vcsRootInstances":{"href":"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:TestProject_PutSetCheckIntervalField)"}}'
|
90
|
+
http_version:
|
91
|
+
recorded_at: Wed, 04 Mar 2015 20:50:42 GMT
|
92
|
+
- request:
|
93
|
+
method: put
|
94
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots/id:TestProject_PutSetCheckIntervalField/modificationCheckInterval
|
95
|
+
body:
|
96
|
+
encoding: US-ASCII
|
97
|
+
string: '86400'
|
98
|
+
headers:
|
99
|
+
User-Agent:
|
100
|
+
- TeamCity Ruby Client 1.3.1
|
101
|
+
Accept:
|
102
|
+
- text/plain
|
103
|
+
Content-Type:
|
104
|
+
- text/plain
|
105
|
+
Accept-Encoding:
|
106
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
107
|
+
response:
|
108
|
+
status:
|
109
|
+
code: 200
|
110
|
+
message: OK
|
111
|
+
headers:
|
112
|
+
Server:
|
113
|
+
- Apache-Coyote/1.1
|
114
|
+
Set-Cookie:
|
115
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
116
|
+
- TCSESSIONID=45616313FB613A3B80A211FFDFB53C86; Path=/; HttpOnly
|
117
|
+
Pragma:
|
118
|
+
- no-cache
|
119
|
+
Expires:
|
120
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
121
|
+
Cache-Control:
|
122
|
+
- no-cache
|
123
|
+
- no-store
|
124
|
+
Content-Type:
|
125
|
+
- text/plain
|
126
|
+
Transfer-Encoding:
|
127
|
+
- chunked
|
128
|
+
Date:
|
129
|
+
- Wed, 04 Mar 2015 20:50:42 GMT
|
130
|
+
body:
|
131
|
+
encoding: UTF-8
|
132
|
+
string: '86400'
|
133
|
+
http_version:
|
134
|
+
recorded_at: Wed, 04 Mar 2015 20:50:42 GMT
|
135
|
+
- request:
|
136
|
+
method: get
|
137
|
+
uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots/id:TestProject_PutSetCheckIntervalField
|
138
|
+
body:
|
139
|
+
encoding: US-ASCII
|
140
|
+
string: ''
|
141
|
+
headers:
|
142
|
+
User-Agent:
|
143
|
+
- TeamCity Ruby Client 1.3.1
|
144
|
+
Accept:
|
145
|
+
- application/json; charset=utf-8
|
146
|
+
Content-Type:
|
147
|
+
- application/json
|
148
|
+
Accept-Encoding:
|
149
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
150
|
+
response:
|
151
|
+
status:
|
152
|
+
code: 200
|
153
|
+
message: OK
|
154
|
+
headers:
|
155
|
+
Server:
|
156
|
+
- Apache-Coyote/1.1
|
157
|
+
Set-Cookie:
|
158
|
+
- RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
|
159
|
+
- TCSESSIONID=14D8C430D47AE4F57F9CA7E239841239; Path=/; HttpOnly
|
160
|
+
Pragma:
|
161
|
+
- no-cache
|
162
|
+
Expires:
|
163
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
164
|
+
Cache-Control:
|
165
|
+
- no-cache
|
166
|
+
- no-store
|
167
|
+
Content-Type:
|
168
|
+
- application/json
|
169
|
+
Transfer-Encoding:
|
170
|
+
- chunked
|
171
|
+
Date:
|
172
|
+
- Wed, 04 Mar 2015 20:50:42 GMT
|
173
|
+
body:
|
174
|
+
encoding: UTF-8
|
175
|
+
string: '{"id":"TestProject_PutSetCheckIntervalField","name":"PutSetCheckIntervalField","vcsName":"jetbrains.git","modificationCheckInterval":86400,"status":"NOT_MONITORED","lastChecked":"20150305T090509+1300","href":"/httpAuth/app/rest/vcs-roots/id:TestProject_PutSetCheckIntervalField","project":{"id":"TestProject","name":"Test
|
176
|
+
project","parentProjectId":"_Root","href":"/httpAuth/app/rest/projects/id:TestProject","webUrl":"http://localhost:8111/project.html?projectId=TestProject"},"properties":{"property":[{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"branch","value":"master"},{"name":"ignoreKnownHosts","value":"true"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"}]},"vcsRootInstances":{"href":"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:TestProject_PutSetCheckIntervalField)"}}'
|
177
|
+
http_version:
|
178
|
+
recorded_at: Wed, 04 Mar 2015 20:50:42 GMT
|
179
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper.rb"
|
2
|
+
|
3
|
+
describe 'FaradayMiddleware' do
|
4
|
+
describe 'NullResponseBody' do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@url = "#{TeamCity::Configuration::DEFAULT_ENDPOINT}projects"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return empty hash if the body is 'null'" do
|
11
|
+
stub_request(:get, @url).to_return(:body => "null", :headers => {:content_type => "application/json; charset=utf-8"})
|
12
|
+
VCR.turned_off do
|
13
|
+
results = TeamCity.get('projects')
|
14
|
+
results.should be_empty
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rspec/autorun'
|
2
|
+
require 'webmock/rspec'
|
3
|
+
require_relative 'support/vcr_setup'
|
4
|
+
|
5
|
+
require File.expand_path('../../lib/teamcity', __FILE__)
|
6
|
+
|
7
|
+
RSpec.configure do |c|
|
8
|
+
c.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
end
|
10
|
+
|
11
|
+
def stub_get(path)
|
12
|
+
stub_request(:get, TeamCity.endpoint + path)
|
13
|
+
end
|
14
|
+
|
15
|
+
def configure_client_with_authentication
|
16
|
+
TeamCity.reset
|
17
|
+
TeamCity.configure do |config|
|
18
|
+
config.endpoint = 'http://localhost:8111/httpAuth/app/rest'
|
19
|
+
config.http_user = 'teamcity-ruby-client'
|
20
|
+
config.http_password = 'teamcity'
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
# See https://www.relishapp.com/vcr/vcr/v/2-4-0/docs/configuration
|
4
|
+
# for more configuration options (make sure and check the version of vcr matches)
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = 'spec/cassettes'
|
7
|
+
c.hook_into :webmock
|
8
|
+
c.configure_rspec_metadata!
|
9
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
describe TeamCity::API do
|
4
|
+
before do
|
5
|
+
@keys = TeamCity::Configuration::VALID_OPTIONS_KEYS
|
6
|
+
end
|
7
|
+
|
8
|
+
context "with module configuration" do
|
9
|
+
|
10
|
+
before do
|
11
|
+
TeamCity.configure do |config|
|
12
|
+
@keys.each do |key|
|
13
|
+
config.send("#{key}=", key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
TeamCity.reset
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should inherit module configuration" do
|
23
|
+
api = TeamCity::API.new
|
24
|
+
@keys.each do |key|
|
25
|
+
api.send(key).should == key
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "with class configuration" do
|
30
|
+
|
31
|
+
before do
|
32
|
+
@configuration = {
|
33
|
+
:adapter => :excon,
|
34
|
+
:endpoint => 'http://teamcity.mydomain.com/',
|
35
|
+
:user_agent => 'My User Agent',
|
36
|
+
:http_user => 'tc-test-user',
|
37
|
+
:http_password => 'tc-test-password'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
context "during initialization"
|
42
|
+
|
43
|
+
it "should override module configuration" do
|
44
|
+
api = TeamCity::API.new(@configuration)
|
45
|
+
@keys.each do |key|
|
46
|
+
api.send(key).should == @configuration[key]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "after initilization" do
|
51
|
+
|
52
|
+
it "should override module configuration after initialization" do
|
53
|
+
api = TeamCity::API.new
|
54
|
+
@configuration.each do |key, value|
|
55
|
+
api.send("#{key}=", value)
|
56
|
+
end
|
57
|
+
@keys.each do |key|
|
58
|
+
api.send(key).should == @configuration[key]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|