teamcity-ruby-client 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +15 -1
  3. data/README.md +4 -2
  4. data/lib/teamcity.rb +1 -0
  5. data/lib/teamcity/client/build_types.rb +25 -16
  6. data/lib/teamcity/client/builds.rb +19 -15
  7. data/lib/teamcity/client/common.rb +0 -12
  8. data/lib/teamcity/client/projects.rb +21 -17
  9. data/lib/teamcity/client/vcs_roots.rb +11 -13
  10. data/lib/teamcity/configuration.rb +1 -5
  11. data/lib/teamcity/connection.rb +7 -7
  12. data/lib/teamcity/headers.rb +47 -0
  13. data/lib/teamcity/request.rb +2 -8
  14. data/lib/teamcity/version.rb +1 -1
  15. data/spec/cassettes/BuildTypes/DELETE/_delete_agent_requirement/should_delete_the_agent_requirement.yml +51 -6
  16. data/spec/cassettes/BuildTypes/DELETE/_delete_buildtype/should_delete_a_buildtype.yml +8 -6
  17. data/spec/cassettes/BuildTypes/DELETE/_delete_buildtype_parameter/should_delete_a_buildtype_parameter.yml +49 -6
  18. data/spec/cassettes/BuildTypes/GET/_buildtype/should_fetch_the_details_of_a_buildtype_by_id.yml +51 -11
  19. data/spec/cassettes/BuildTypes/GET/_buildtype/should_raise_an_error_if_the_buildtype_does_not_exist.yml +8 -6
  20. data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_fetch_the_build_configuration_agent_requirements_for_a_buildtype.yml +9 -7
  21. data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_return_an_array.yml +9 -7
  22. data/spec/cassettes/BuildTypes/GET/_buildtype_agent_requirements/should_return_nil_if_there_are_no_agent_requirements_defined.yml +9 -7
  23. data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_fetch_the_build_configuration_artifact_dependencies_for_a_buildtype.yml +9 -7
  24. data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_return_an_array.yml +9 -7
  25. data/spec/cassettes/BuildTypes/GET/_buildtype_artifact_dependencies/should_return_nil_if_there_are_no_artifact_dependencies_defined.yml +9 -7
  26. data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_fetch_the_build_configuration_features_for_a_buildtype.yml +9 -7
  27. data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_return_an_array.yml +9 -7
  28. data/spec/cassettes/BuildTypes/GET/_buildtype_features/should_return_nil_if_there_are_no_features_defined.yml +9 -7
  29. data/spec/cassettes/BuildTypes/GET/_buildtype_investigations/should_get_investigation_details.yml +11 -11
  30. data/spec/cassettes/BuildTypes/GET/_buildtype_investigations/should_return_nil_if_no_one_is_investigating.yml +9 -7
  31. data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_fetch_the_build_configuration_parameters_for_a_buildtype.yml +9 -7
  32. data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_return_an_array.yml +9 -7
  33. data/spec/cassettes/BuildTypes/GET/_buildtype_parameters/should_return_nil_if_there_are_no_parameters_defined.yml +9 -7
  34. data/spec/cassettes/BuildTypes/GET/_buildtype_settings/should_fetch_the_settings_for_a_given_buildtype.yml +51 -6
  35. data/spec/cassettes/BuildTypes/GET/_buildtype_settings/should_return_an_array.yml +51 -6
  36. data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_fetch_the_build_configuration_snapshot_dependencies_for_a_buildtype.yml +9 -7
  37. data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_return_an_array.yml +9 -7
  38. data/spec/cassettes/BuildTypes/GET/_buildtype_snapshot_dependencies/should_return_nil_if_there_are_no_snapshot_dependencies_defined.yml +9 -7
  39. data/spec/cassettes/BuildTypes/GET/_buildtype_state/should_fetch_the_state_of_the_buildtype.yml +89 -0
  40. data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_fetch_the_build_configuration_steps_for_a_buildtype.yml +10 -9
  41. data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_return_an_array.yml +9 -9
  42. data/spec/cassettes/BuildTypes/GET/_buildtype_steps/should_return_nil_if_there_are_no_steps_defined.yml +9 -7
  43. data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_return_nil_if_the_buildtype_is_not_associated_with_a_template.yml +8 -6
  44. data/spec/cassettes/BuildTypes/GET/_buildtype_template/should_return_the_attributes_of_the_associated_template.yml +9 -8
  45. data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_fetch_the_build_configuration_triggers_for_a_buildtype.yml +8 -6
  46. data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_return_an_array.yml +8 -6
  47. data/spec/cassettes/BuildTypes/GET/_buildtype_triggers/should_return_nil_if_there_are_no_triggers_defined.yml +9 -7
  48. data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_fetch_the_build_configuration_vcs_root_entries_for_a_buildtype.yml +10 -8
  49. data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_return_an_array.yml +10 -8
  50. data/spec/cassettes/BuildTypes/GET/_buildtype_vcs_root_entries/should_return_nil_if_there_are_no_vcs_root_entries_defined.yml +9 -7
  51. data/spec/cassettes/BuildTypes/GET/_buildtypes/should_fetch_all_the_buildtypes.yml +9 -12
  52. data/spec/cassettes/BuildTypes/POST/_attach_vcs_root/should_attach_a_vcs_root_to_a_buildtype.yml +9 -9
  53. data/spec/cassettes/BuildTypes/POST/_create_agent_requirement/should_create_an_agent_requirement_for_a_buildtype.yml +10 -9
  54. data/spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_disable_a_build_step.yml +14 -10
  55. data/spec/cassettes/BuildTypes/PUT/_set_build_step_field/should_enable_a_build_step.yml +18 -10
  56. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_pause_a_project.yml +14 -10
  57. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_a_projects_description.yml +15 -11
  58. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_field/should_set_the_buildtype_name.yml +15 -11
  59. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_parameter/should_set_a_buildtype_parameter.yml +15 -11
  60. data/spec/cassettes/Builds/DELETE/_unpin_build/should_unpin_a_build.yml +51 -6
  61. data/spec/cassettes/Builds/GET/_build/should_fetch_the_build_details.yml +53 -11
  62. data/spec/cassettes/Builds/GET/_build/should_raise_an_error_if_the_build_does_not_exist.yml +16 -13
  63. data/spec/cassettes/Builds/GET/_build_pinned_/should_return_false_when_a_build_is_not_pinned.yml +126 -0
  64. data/spec/cassettes/Builds/GET/_build_pinned_/should_return_true_when_a_build_is_pinned.yml +126 -0
  65. data/spec/cassettes/Builds/GET/_build_statistics/should_return_statistics_for_a_build.yml +50 -5
  66. data/spec/cassettes/Builds/GET/_build_tags/should_fetch_the_build_tags.yml +51 -6
  67. 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
  68. data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_filter_by_multiple_build_locators.yml +9 -7
  69. data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_filter_results_by_build_locators.yml +9 -7
  70. data/spec/cassettes/Builds/GET/_builds/should_fetch_all_the_builds.yml +9 -7
  71. 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
  72. data/spec/cassettes/Builds/PUT/_pin_build/should_pin_a_build.yml +49 -6
  73. data/spec/cassettes/Projects/DELETE/_delete_project/should_delete_a_project.yml +17 -14
  74. data/spec/cassettes/Projects/DELETE/_delete_project_parameter/should_delete_a_project_parameter.yml +91 -6
  75. data/spec/cassettes/Projects/GET/_project/should_fetch_a_single_project_by_id.yml +10 -10
  76. data/spec/cassettes/Projects/GET/_project/should_raise_an_error_if_the_project_does_not_exist.yml +9 -7
  77. data/spec/cassettes/Projects/GET/_project_buildtypes/should_fetch_all_the_buildTypes_for_a_project.yml +9 -8
  78. 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
  79. data/spec/cassettes/Projects/GET/_project_parameters/should_fetch_all_the_paramters_for_a_given_project.yml +9 -7
  80. data/spec/cassettes/Projects/GET/_project_parameters/should_return_nil_if_there_are_no_parameters_defined_for_a_project.yml +9 -7
  81. data/spec/cassettes/Projects/GET/_projects/should_fetch_projects.yml +9 -9
  82. data/spec/cassettes/Projects/POST/_copy_project/should_copy_a_project.yml +61 -15
  83. data/spec/cassettes/Projects/POST/_create_project/should_create_a_project.yml +9 -8
  84. data/spec/cassettes/Projects/PUT/_set_project_field/should_archive_a_project.yml +56 -10
  85. data/spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_description.yml +56 -10
  86. data/spec/cassettes/Projects/PUT/_set_project_field/should_set_a_projects_name.yml +56 -10
  87. data/spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter.yml +56 -10
  88. data/spec/cassettes/VCSRoots/GET/_vcs_root_details/should_fetch_the_vcs_root_details.yml +53 -6
  89. data/spec/cassettes/VCSRoots/GET/_vcs_roots/should_fetch_vcs_roots.yml +10 -7
  90. 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
  91. data/spec/spec_helper.rb +1 -1
  92. data/spec/teamcity/api_spec.rb +0 -1
  93. data/spec/teamcity/client/builds_spec.rb +36 -56
  94. data/spec/teamcity/client/buildtypes_spec.rb +78 -42
  95. data/spec/teamcity/client/projects_spec.rb +41 -32
  96. data/spec/teamcity/client/vcs_roots_spec.rb +9 -29
  97. data/spec/teamcity/client_spec.rb +5 -1
  98. data/spec/teamcity/headers_spec.rb +43 -0
  99. data/spec/teamcity_spec.rb +1 -28
  100. data/teamcity-ruby-client.gemspec +1 -0
  101. metadata +21 -23
  102. 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
  103. data/spec/cassettes/Builds/GET/_build_tags/should_return_nil_if_there_are_no_build_tags_defined_for_a_build.yml +0 -44
  104. data/spec/cassettes/Builds/GET/_builds/should_allow_you_to_search_by_locator.yml +0 -44
  105. data/spec/cassettes/Projects/GET/_project_buildtypes/should_return_nil_if_the_project_does_not_have_any_build_build_types.yml +0 -44
  106. data/spec/cassettes/Projects/PUT/_set_project_field/should_un-archive_a_project.yml +0 -50
  107. data/spec/cassettes/Projects/PUT/_set_project_parameter/should_set_a_project_parameter_with_a_boolean_value.yml +0 -40
  108. data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_shared_vcs_root.yml +0 -45
  109. data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_vcs_root_that_is_only_shared_within_a_project.yml +0 -48
@@ -1,28 +1,70 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: put
5
- uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/projects/project2/parameters/set-this-parameter
4
+ method: post
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
6
6
  body:
7
7
  encoding: US-ASCII
8
- string: some-value
8
+ string: PutCreateProjectParam
9
9
  headers:
10
+ User-Agent:
11
+ - TeamCity Ruby Client 0.4.0
10
12
  Accept:
11
13
  - application/json; charset=utf-8
14
+ Content-Type:
15
+ - text/plain
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Set-Cookie:
24
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
25
+ - TCSESSIONID=38F07F472DD6656B4F7DFFDD7BCB099B; Path=/; HttpOnly
26
+ Pragma:
27
+ - no-cache
28
+ Expires:
29
+ - Thu, 01 Jan 1970 00:00:00 GMT
30
+ Cache-Control:
31
+ - no-cache
32
+ - no-store
33
+ Content-Type:
34
+ - application/json
35
+ Transfer-Encoding:
36
+ - chunked
37
+ Date:
38
+ - Wed, 14 Aug 2013 02:31:01 GMT
39
+ body:
40
+ encoding: US-ASCII
41
+ string: ! '{"id":"PutCreateProjectParam","name":"PutCreateProjectParam","href":"/httpAuth/app/rest/projects/id:PutCreateProjectParam","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PutCreateProjectParam","parentProject":{"id":"_Root","name":"<Root
42
+ project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PutCreateProjectParam)"},"projects":{"project":[]}}'
43
+ http_version:
44
+ recorded_at: Wed, 14 Aug 2013 02:31:01 GMT
45
+ - request:
46
+ method: put
47
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects/PutCreateProjectParam/parameters/set-with-param
48
+ body:
49
+ encoding: US-ASCII
50
+ string: some-value
51
+ headers:
12
52
  User-Agent:
13
- - TeamCity Ruby Client 0.1.0
53
+ - TeamCity Ruby Client 0.4.0
54
+ Accept:
55
+ - text/plain
14
56
  Content-Type:
15
57
  - text/plain
16
58
  response:
17
59
  status:
18
- code: 204
19
- message: No Content
60
+ code: 200
61
+ message: OK
20
62
  headers:
21
63
  Server:
22
64
  - Apache-Coyote/1.1
23
65
  Set-Cookie:
24
- - JSESSIONID=155B49584EEB5230B10BBAC7DAB270DD; Path=/; HttpOnly
25
66
  - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
67
+ - TCSESSIONID=DBCB09D9B7AD076E2256FF2930450E3A; Path=/; HttpOnly
26
68
  Pragma:
27
69
  - no-cache
28
70
  Expires:
@@ -30,11 +72,15 @@ http_interactions:
30
72
  Cache-Control:
31
73
  - no-cache
32
74
  - no-store
75
+ Content-Type:
76
+ - text/plain
77
+ Transfer-Encoding:
78
+ - chunked
33
79
  Date:
34
- - Fri, 03 May 2013 19:56:03 GMT
80
+ - Wed, 14 Aug 2013 02:31:01 GMT
35
81
  body:
36
82
  encoding: US-ASCII
37
- string: ''
83
+ string: some-value
38
84
  http_version:
39
- recorded_at: Fri, 03 May 2013 19:56:03 GMT
85
+ recorded_at: Wed, 14 Aug 2013 02:31:01 GMT
40
86
  recorded_with: VCR 2.4.0
@@ -2,15 +2,61 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/vcs-roots/id:1
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
+ User-Agent:
11
+ - TeamCity Ruby Client 0.4.0
10
12
  Accept:
11
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=447067EED9E77DA8E82F8164E833C3DA; 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, 14 Aug 2013 14:51:16 GMT
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"count":3,"vcs-root":[{"id":"teamcity_ruby_client","name":"teamcity
44
+ ruby client","href":"/httpAuth/app/rest/vcs-roots/id:teamcity_ruby_client"},{"id":"sharedvcsroot","name":"sharedvcsroot","href":"/httpAuth/app/rest/vcs-roots/id:sharedvcsroot"},{"id":"copy_test","name":"copy-test","href":"/httpAuth/app/rest/vcs-roots/id:copy_test"}]}'
45
+ http_version:
46
+ recorded_at: Wed, 14 Aug 2013 14:51:16 GMT
47
+ - request:
48
+ method: get
49
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots/id:teamcity_ruby_client
50
+ body:
51
+ encoding: US-ASCII
52
+ string: ''
53
+ headers:
12
54
  User-Agent:
13
- - TeamCity Ruby Client 0.2.0
55
+ - TeamCity Ruby Client 0.4.0
56
+ Accept:
57
+ - application/json; charset=utf-8
58
+ Content-Type:
59
+ - application/json
14
60
  Accept-Encoding:
15
61
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
62
  response:
@@ -21,8 +67,8 @@ http_interactions:
21
67
  Server:
22
68
  - Apache-Coyote/1.1
23
69
  Set-Cookie:
24
- - JSESSIONID=21898D5DEC5FD7973C78F960725A1256; Path=/; HttpOnly
25
70
  - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
71
+ - TCSESSIONID=63B01143F0BFD43FBBA4F13124629BD6; Path=/; HttpOnly
26
72
  Pragma:
27
73
  - no-cache
28
74
  Expires:
@@ -35,10 +81,11 @@ http_interactions:
35
81
  Transfer-Encoding:
36
82
  - chunked
37
83
  Date:
38
- - Mon, 06 May 2013 18:14:22 GMT
84
+ - Wed, 14 Aug 2013 14:51:16 GMT
39
85
  body:
40
86
  encoding: US-ASCII
41
- string: ! '{"id":1,"name":"teamcity ruby client","vcsName":"jetbrains.git","shared":true,"status":"FINISHED","lastChecked":"20130506T141359-0400","properties":{"property":[{"name":"agentCleanFilesPolicy","value":"ALL_UNTRACKED"},{"name":"agentCleanPolicy","value":"ON_BRANCH_CHANGE"},{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"branch","value":"master"},{"name":"ignoreKnownHosts","value":"true"},{"name":"submoduleCheckout","value":"CHECKOUT"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"},{"name":"usernameStyle","value":"USERID"}]}}'
87
+ string: ! '{"id":"teamcity_ruby_client","name":"teamcity ruby client","vcsName":"jetbrains.git","status":"FINISHED","lastChecked":"20130814T105029-0400","href":"/httpAuth/app/rest/vcs-roots/id:teamcity_ruby_client","project":{"id":"_Root","name":"<Root
88
+ project>","href":"/httpAuth/app/rest/projects/id:_Root"},"properties":{"property":[{"name":"agentCleanFilesPolicy","value":"ALL_UNTRACKED"},{"name":"agentCleanPolicy","value":"ON_BRANCH_CHANGE"},{"name":"authMethod","value":"PRIVATE_KEY_DEFAULT"},{"name":"branch","value":"master"},{"name":"ignoreKnownHosts","value":"true"},{"name":"submoduleCheckout","value":"CHECKOUT"},{"name":"url","value":"git@github.com:jperry/teamcity-ruby-client.git"},{"name":"usernameStyle","value":"USERID"}]},"vcsRootInstances":{"href":"/httpAuth/app/rest/vcs-root-instances?locator=vcsRoot:(id:teamcity_ruby_client)"}}'
42
89
  http_version:
43
- recorded_at: Mon, 06 May 2013 18:14:22 GMT
90
+ recorded_at: Wed, 14 Aug 2013 14:51:16 GMT
44
91
  recorded_with: VCR 2.4.0
@@ -2,15 +2,17 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/7.0/vcs-roots
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
+ User-Agent:
11
+ - TeamCity Ruby Client 0.4.0
10
12
  Accept:
11
13
  - application/json; charset=utf-8
12
- User-Agent:
13
- - TeamCity Ruby Client 0.2.0
14
+ Content-Type:
15
+ - application/json
14
16
  Accept-Encoding:
15
17
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
18
  response:
@@ -21,8 +23,8 @@ http_interactions:
21
23
  Server:
22
24
  - Apache-Coyote/1.1
23
25
  Set-Cookie:
24
- - JSESSIONID=EB68C7AA38D9B38C86FDF4D53177D074; Path=/; HttpOnly
25
26
  - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
27
+ - TCSESSIONID=92762B5E1803DF1B9B1B453D51ED7486; Path=/; HttpOnly
26
28
  Pragma:
27
29
  - no-cache
28
30
  Expires:
@@ -35,10 +37,11 @@ http_interactions:
35
37
  Transfer-Encoding:
36
38
  - chunked
37
39
  Date:
38
- - Mon, 06 May 2013 18:14:22 GMT
40
+ - Wed, 14 Aug 2013 14:50:20 GMT
39
41
  body:
40
42
  encoding: US-ASCII
41
- string: ! '{"vcs-root":[{"id":"1","name":"teamcity ruby client","href":"/httpAuth/app/rest/7.0/vcs-roots/id:1"}]}'
43
+ string: ! '{"count":3,"vcs-root":[{"id":"teamcity_ruby_client","name":"teamcity
44
+ ruby client","href":"/httpAuth/app/rest/vcs-roots/id:teamcity_ruby_client"},{"id":"sharedvcsroot","name":"sharedvcsroot","href":"/httpAuth/app/rest/vcs-roots/id:sharedvcsroot"},{"id":"copy_test","name":"copy-test","href":"/httpAuth/app/rest/vcs-roots/id:copy_test"}]}'
42
45
  http_version:
43
- recorded_at: Mon, 06 May 2013 18:14:22 GMT
46
+ recorded_at: Wed, 14 Aug 2013 14:50:20 GMT
44
47
  recorded_with: VCR 2.4.0
@@ -0,0 +1,90 @@
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 0.4.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=637F24F5193BAEE7E2E22A2F1DF0F4F2; 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, 14 Aug 2013 15:18:38 GMT
41
+ body:
42
+ encoding: US-ASCII
43
+ string: ! '{"project":[{"id":"_Root","name":"<Root project>","href":"/httpAuth/app/rest/projects/id:_Root"},{"id":"BuildTests","name":"BuildTests","href":"/httpAuth/app/rest/projects/id:BuildTests"},{"id":"BuildTypeTests","name":"BuildTypeTests","href":"/httpAuth/app/rest/projects/id:BuildTypeTests"},{"id":"DeleteProjectParameters","name":"DeleteProjectParameters","href":"/httpAuth/app/rest/projects/id:DeleteProjectParameters"},{"id":"GetProjectBuildTypes","name":"GetProjectBuildTypes","href":"/httpAuth/app/rest/projects/id:GetProjectBuildTypes"},{"id":"GetProjectRequest","name":"GetProjectRequest","href":"/httpAuth/app/rest/projects/id:GetProjectRequest"},{"id":"GetProjectWithNoBuildTypes","name":"GetProjectWithNoBuildTypes","href":"/httpAuth/app/rest/projects/id:GetProjectWithNoBuildTypes"},{"id":"GetProjectWithNoParameters","name":"GetProjectWithNoParameters","href":"/httpAuth/app/rest/projects/id:GetProjectWithNoParameters"},{"id":"GetProjectWithParameters","name":"GetProjectWithParameters","href":"/httpAuth/app/rest/projects/id:GetProjectWithParameters"},{"id":"PostCopyProject","name":"PostCopyProject","href":"/httpAuth/app/rest/projects/id:PostCopyProject"},{"id":"PostCreateProject","name":"PostCreateProject","href":"/httpAuth/app/rest/projects/id:PostCreateProject"},{"id":"PostProjectToBeCopied","name":"PostProjectToBeCopied","href":"/httpAuth/app/rest/projects/id:PostProjectToBeCopied"},{"id":"PutCreateProjectParam","name":"PutCreateProjectParam","href":"/httpAuth/app/rest/projects/id:PutCreateProjectParam"},{"id":"PutSetProjectNameField","name":"PutNewProjectName","href":"/httpAuth/app/rest/projects/id:PutSetProjectNameField"},{"id":"PutSetProjectDescriptionField","name":"PutSetProjectDescriptionField","href":"/httpAuth/app/rest/projects/id:PutSetProjectDescriptionField"},{"id":"PutSetProjectArchiveField","name":"PutSetProjectArchiveField","href":"/httpAuth/app/rest/projects/id:PutSetProjectArchiveField"}]}'
44
+ http_version:
45
+ recorded_at: Wed, 14 Aug 2013 15:18:38 GMT
46
+ - request:
47
+ method: post
48
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/vcs-roots
49
+ body:
50
+ encoding: US-ASCII
51
+ string: <vcs-root name="PostCreateVCSRoot" vcsName="jetbrains.git" projectLocator="BuildTests"><properties><property
52
+ name="branch" value="master"/><property name="url" value="git@github.com:jperry/teamcity-ruby-client.git"/><property
53
+ name="authMethod" value="PRIVATE_KEY_DEFAULT"/><property name="ignoreKnownHosts"
54
+ value="true"/></properties></vcs-root>
55
+ headers:
56
+ User-Agent:
57
+ - TeamCity Ruby Client 0.4.0
58
+ Accept:
59
+ - application/json; charset=utf-8
60
+ Content-Type:
61
+ - application/xml
62
+ response:
63
+ status:
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ Server:
68
+ - Apache-Coyote/1.1
69
+ Set-Cookie:
70
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
71
+ - TCSESSIONID=97DCE4F1BCDD9F6AB117265DA0CAF7FB; Path=/; HttpOnly
72
+ Pragma:
73
+ - no-cache
74
+ Expires:
75
+ - Thu, 01 Jan 1970 00:00:00 GMT
76
+ Cache-Control:
77
+ - no-cache
78
+ - no-store
79
+ Content-Type:
80
+ - application/json
81
+ Transfer-Encoding:
82
+ - chunked
83
+ Date:
84
+ - Wed, 14 Aug 2013 15:18:38 GMT
85
+ body:
86
+ encoding: US-ASCII
87
+ string: ! '{"id":"BuildTests_PostCreateVCSRoot","name":"PostCreateVCSRoot","vcsName":"jetbrains.git","status":"NOT_MONITORED","lastChecked":"20130813T212053-0400","href":"/httpAuth/app/rest/vcs-roots/id:BuildTests_PostCreateVCSRoot","project":{"id":"BuildTests","name":"BuildTests","href":"/httpAuth/app/rest/projects/id:BuildTests"},"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:BuildTests_PostCreateVCSRoot)"}}'
88
+ http_version:
89
+ recorded_at: Wed, 14 Aug 2013 15:18:38 GMT
90
+ recorded_with: VCR 2.4.0
data/spec/spec_helper.rb CHANGED
@@ -15,7 +15,7 @@ end
15
15
  def configure_client_with_authentication
16
16
  TeamCity.reset
17
17
  TeamCity.configure do |config|
18
- config.endpoint = 'http://localhost:8111/httpAuth/app/rest/7.0/'
18
+ config.endpoint = 'http://localhost:8111/httpAuth/app/rest'
19
19
  config.http_user = 'teamcity-ruby-client'
20
20
  config.http_password = 'teamcity'
21
21
  end
@@ -32,7 +32,6 @@ describe TeamCity::API do
32
32
  @configuration = {
33
33
  :adapter => :excon,
34
34
  :endpoint => 'http://teamcity.mydomain.com/',
35
- :format => :xml,
36
35
  :user_agent => 'My User Agent',
37
36
  :http_user => 'tc-test-user',
38
37
  :http_password => 'tc-test-password'
@@ -4,121 +4,101 @@ describe 'Builds' do
4
4
 
5
5
  before(:each) do
6
6
  @tc = TeamCity
7
- end
8
-
9
- before(:all) do
10
- TeamCity.configure do |config|
11
- config.endpoint = 'http://localhost:8111/guestAuth/app/rest/7.0/'
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
 
13
+ before(:each) do
14
+ @buildtype_id = 'BuildTests_GetBuildTests'
15
+ end
16
+
22
17
  describe '.builds' do
23
18
  it 'should fetch all the builds' do
24
- @tc.builds.size.should eq(4)
19
+ builds = @tc.builds
20
+ builds.should have_at_least(1).items
25
21
  end
26
22
 
27
23
  it 'should allow you to filter results by build locators' do
28
- @tc.builds(count:2).size.should eq(2)
24
+ @tc.builds(count:1).should have(1).items
29
25
  end
30
26
 
31
27
  it 'should allow you to filter by multiple build locators' do
32
- @tc.builds(count: 2, status: 'SUCCESS').size.should eq(2)
28
+ @tc.builds(count: 2, status: 'SUCCESS').should have(2).items
29
+ end
30
+
31
+ it 'should return an empty array if no results are found' do
32
+ @tc.builds(tags: 'return-empty-result').should be_empty
33
33
  end
34
34
  end
35
35
 
36
36
  describe '.build' do
37
37
  it 'should fetch the build details' do
38
- @tc.build(id: 2).id.should eq(2)
38
+ build_id = @tc.builds.first.id
39
+ @tc.build(id: build_id).id.should eq(build_id)
39
40
  end
40
41
 
41
42
  it 'should raise an error if the build does not exist' do
42
- expect { @tc.build(id: 10000) }.to raise_error
43
+ expect { @tc.build(id: 'doesnotexist') }.to raise_error
43
44
  end
44
45
 
45
46
  it 'should raise an error if an id is not provided' do
46
- expect { @tc.build }.to raise_error
47
+ expect { @tc.build }.to raise_exception(ArgumentError)
47
48
  end
48
49
  end
49
50
 
50
51
  describe '.build_tags' do
51
52
  it 'should fetch the build tags' do
52
- tags = @tc.build_tags(id: 2)
53
- tags.size.should eq(1)
54
- tags.first.should eq('release_tag')
53
+ build = @tc.builds(tags: 'tag-test').first
54
+ tags = @tc.build_tags(id: build.id)
55
+ tags.should include('tag-test')
55
56
  end
56
57
 
57
- it 'should return nil if there are no build tags defined for a build' do
58
- @tc.build_tags(id: 1).should be_nil
58
+ it 'should return an empty array if there are no build tags defined for a build' do
59
+ build = @tc.builds.first
60
+ @tc.build_tags(id: build.id).should be_empty
59
61
  end
60
62
  end
61
63
 
62
64
  describe '.build_pinned?', :vcr do
63
- before(:all) do
64
- configure_client_with_authentication
65
- end
66
-
67
65
  it 'should return true when a build is pinned' do
68
- pending
69
- @tc.pin_build('27')
70
- @tc.build_pinned?('27').should be_true
66
+ build_to_pin = @tc.builds.first
67
+ @tc.pin_build(build_to_pin.id)
68
+ @tc.build_pinned?(build_to_pin.id).should be_true
71
69
  end
72
70
 
73
71
  it 'should return false when a build is not pinned' do
74
- pending
75
- @tc.unpin_build('27')
76
- @tc.build_pinned?('27').should be_false
72
+ build_to_unpin = @tc.builds.first
73
+ @tc.unpin_build(build_to_unpin.id)
74
+ @tc.build_pinned?(build_to_unpin.id).should be_false
77
75
  end
78
76
  end
79
77
 
80
78
  describe '.build_statistics' do
81
- before(:all) do
82
- configure_client_with_authentication
83
- end
84
-
85
79
  it 'should return statistics for a build' do
86
- result = @tc.build_statistics('30')
87
- result.first.name.should_not be_empty
88
- result.first.value.should_not be_empty
89
- end
90
-
91
- it 'should return an empty string for a build with no statistics' do
92
- @tc.build_statistics('28').should be_nil
80
+ build = @tc.builds.first
81
+ results = @tc.build_statistics(build.id)
82
+ results.should have_at_least(1).items
93
83
  end
94
84
  end
95
85
  end
96
86
 
97
87
  describe 'PUT', :vcr do
98
-
99
- before(:all) do
100
- configure_client_with_authentication
101
- end
102
-
103
88
  describe '.pin_build' do
104
89
  it 'should pin a build' do
105
- id = '27'
90
+ build_to_pin = @tc.builds.first
106
91
  comment = 'this will add a comment'
107
- @tc.pin_build(id, comment).should be_nil
92
+ @tc.pin_build(build_to_pin.id, comment).should be_nil
108
93
  end
109
94
  end
110
95
  end
111
96
 
112
97
  describe 'DELETE', :vcr do
113
-
114
- before(:all) do
115
- configure_client_with_authentication
116
- end
117
-
118
98
  describe '.unpin_build' do
119
99
  it 'should unpin a build' do
120
- id = '27'
121
- @tc.unpin_build(id).should be_nil
100
+ build_to_unpin = @tc.builds.first
101
+ @tc.unpin_build(build_to_unpin.id).should be_nil
122
102
  end
123
103
  end
124
104
  end