teamcity-ruby-client 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +8 -8
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +15 -3
  4. data/Guardfile +9 -0
  5. data/lib/teamcity.rb +1 -0
  6. data/lib/teamcity/client.rb +1 -2
  7. data/lib/teamcity/client/build_types.rb +94 -23
  8. data/lib/teamcity/client/projects.rb +37 -8
  9. data/lib/teamcity/client/vcs_roots.rb +9 -16
  10. data/lib/teamcity/element_builder.rb +27 -0
  11. data/lib/teamcity/version.rb +1 -1
  12. data/spec/cassettes/BuildTypes/POST/_attach_vcs_root/should_attach_a_vcs_root_to_a_buildtype.yml +12 -10
  13. data/spec/cassettes/BuildTypes/POST/_create_agent_requirement/should_create_an_agent_requirement_for_a_buildtype.yml +11 -11
  14. data/spec/cassettes/BuildTypes/POST/_create_build_step/should_create_a_build_step_for_a_given_build_type.yml +46 -0
  15. data/spec/cassettes/BuildTypes/POST/_create_build_trigger/should_create_a_build_trigger_for_a_given_build_type.yml +46 -0
  16. data/spec/cassettes/BuildTypes/POST/_create_buildtype/should_create_a_build_type.yml +86 -0
  17. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_setting/should_set_if_it_should_perform_clean_builds.yml +46 -0
  18. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_setting/should_set_what_is_the_timeout_in_minutes_when_executing_builds.yml +46 -0
  19. data/spec/cassettes/BuildTypes/PUT/_set_buildtype_setting/should_set_where_the_checkout_happens_when_building.yml +46 -0
  20. data/spec/cassettes/Projects/GET/_parent_project/should_fetch_the_parent_project_for_a_given_project.yml +46 -0
  21. data/spec/cassettes/Projects/GET/_parent_project/should_return_nil_if_there_is_no_parent_project_for_a_given_project.yml +46 -0
  22. data/spec/cassettes/Projects/POST/_copy_project/should_copy_a_project.yml +27 -24
  23. data/spec/cassettes/Projects/PUT/_set_parent_project/should_set_a_parent_project_for_a_given_project.yml +134 -0
  24. 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
  25. 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
  26. data/spec/teamcity/api_spec.rb +1 -1
  27. data/spec/teamcity/client/buildtypes_spec.rb +58 -2
  28. data/spec/teamcity/client/projects_spec.rb +36 -2
  29. data/spec/teamcity/client/vcs_roots_spec.rb +17 -3
  30. data/spec/teamcity/client_spec.rb +2 -2
  31. data/spec/teamcity/element_builder_spec.rb +30 -0
  32. data/spec/teamcity/headers_spec.rb +2 -2
  33. data/teamcity-ruby-client.gemspec +2 -3
  34. metadata +44 -33
  35. data/spec/cassettes/VCSRoots/POST/_create_vcs_root/should_create_a_vcs_root_that_is_shared_with_the_project_and_sub-projects.yml +0 -90
@@ -4,15 +4,17 @@ http_interactions:
4
4
  method: post
5
5
  uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
6
6
  body:
7
- encoding: US-ASCII
7
+ encoding: UTF-8
8
8
  string: PostProjectToBeCopied
9
9
  headers:
10
10
  User-Agent:
11
- - TeamCity Ruby Client 0.4.0
11
+ - TeamCity Ruby Client 1.1.0
12
12
  Accept:
13
13
  - application/json; charset=utf-8
14
14
  Content-Type:
15
15
  - text/plain
16
+ Accept-Encoding:
17
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
18
  response:
17
19
  status:
18
20
  code: 200
@@ -22,7 +24,7 @@ http_interactions:
22
24
  - Apache-Coyote/1.1
23
25
  Set-Cookie:
24
26
  - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
25
- - TCSESSIONID=EB8FC3077515BB9F2FB21C7C298F881E; Path=/; HttpOnly
27
+ - TCSESSIONID=C524A92CB7B041209DBD675EE6C68D5C; Path=/; HttpOnly
26
28
  Pragma:
27
29
  - no-cache
28
30
  Expires:
@@ -35,13 +37,13 @@ http_interactions:
35
37
  Transfer-Encoding:
36
38
  - chunked
37
39
  Date:
38
- - Wed, 14 Aug 2013 02:17:53 GMT
40
+ - Wed, 27 Nov 2013 20:29:38 GMT
39
41
  body:
40
- encoding: US-ASCII
41
- string: ! '{"id":"PostProjectToBeCopied","name":"PostProjectToBeCopied","href":"/httpAuth/app/rest/projects/id:PostProjectToBeCopied","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PostProjectToBeCopied","parentProject":{"id":"_Root","name":"<Root
42
+ encoding: UTF-8
43
+ string: '{"id":"PostProjectToBeCopied","name":"PostProjectToBeCopied","href":"/httpAuth/app/rest/projects/id:PostProjectToBeCopied","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PostProjectToBeCopied","parentProject":{"id":"_Root","name":"<Root
42
44
  project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PostProjectToBeCopied)"},"projects":{"project":[]}}'
43
45
  http_version:
44
- recorded_at: Wed, 14 Aug 2013 02:17:53 GMT
46
+ recorded_at: Wed, 27 Nov 2013 20:29:37 GMT
45
47
  - request:
46
48
  method: get
47
49
  uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects/id:PostProjectToBeCopied
@@ -50,7 +52,7 @@ http_interactions:
50
52
  string: ''
51
53
  headers:
52
54
  User-Agent:
53
- - TeamCity Ruby Client 0.4.0
55
+ - TeamCity Ruby Client 1.1.0
54
56
  Accept:
55
57
  - application/json; charset=utf-8
56
58
  Content-Type:
@@ -66,7 +68,7 @@ http_interactions:
66
68
  - Apache-Coyote/1.1
67
69
  Set-Cookie:
68
70
  - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
69
- - TCSESSIONID=F1707A337A6E252376447F6E0ADEA9CC; Path=/; HttpOnly
71
+ - TCSESSIONID=0874EA804EEA83392E1E89C7C825349F; Path=/; HttpOnly
70
72
  Pragma:
71
73
  - no-cache
72
74
  Expires:
@@ -79,27 +81,28 @@ http_interactions:
79
81
  Transfer-Encoding:
80
82
  - chunked
81
83
  Date:
82
- - Wed, 14 Aug 2013 02:17:53 GMT
84
+ - Wed, 27 Nov 2013 20:29:38 GMT
83
85
  body:
84
- encoding: US-ASCII
85
- string: ! '{"id":"PostProjectToBeCopied","name":"PostProjectToBeCopied","href":"/httpAuth/app/rest/projects/id:PostProjectToBeCopied","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PostProjectToBeCopied","parentProject":{"id":"_Root","name":"<Root
86
+ encoding: UTF-8
87
+ string: '{"id":"PostProjectToBeCopied","name":"PostProjectToBeCopied","href":"/httpAuth/app/rest/projects/id:PostProjectToBeCopied","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PostProjectToBeCopied","parentProject":{"id":"_Root","name":"<Root
86
88
  project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PostProjectToBeCopied)"},"projects":{"project":[]}}'
87
89
  http_version:
88
- recorded_at: Wed, 14 Aug 2013 02:17:53 GMT
90
+ recorded_at: Wed, 27 Nov 2013 20:29:37 GMT
89
91
  - request:
90
92
  method: post
91
93
  uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
92
94
  body:
93
- encoding: US-ASCII
94
- string: <newProjectDescription copyAllAssociatedSettings="true" shareVCSRoots="true"
95
- name="PostCopyProject" sourceProject="id:PostProjectToBeCopied"/>
95
+ encoding: UTF-8
96
+ string: '{"sourceProject":{"locator":"PostProjectToBeCopied"},"name":"PostCopyProject"}'
96
97
  headers:
97
98
  User-Agent:
98
- - TeamCity Ruby Client 0.4.0
99
+ - TeamCity Ruby Client 1.1.0
99
100
  Accept:
100
101
  - application/json; charset=utf-8
101
102
  Content-Type:
102
- - application/xml
103
+ - application/json
104
+ Accept-Encoding:
105
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
103
106
  response:
104
107
  status:
105
108
  code: 200
@@ -109,7 +112,7 @@ http_interactions:
109
112
  - Apache-Coyote/1.1
110
113
  Set-Cookie:
111
114
  - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
112
- - TCSESSIONID=3AA892705059A6D172EFA1A5E81A441A; Path=/; HttpOnly
115
+ - TCSESSIONID=687AEBA930FEAC1E99A573B40E886819; Path=/; HttpOnly
113
116
  Pragma:
114
117
  - no-cache
115
118
  Expires:
@@ -122,11 +125,11 @@ http_interactions:
122
125
  Transfer-Encoding:
123
126
  - chunked
124
127
  Date:
125
- - Wed, 14 Aug 2013 02:17:53 GMT
128
+ - Wed, 27 Nov 2013 20:29:38 GMT
126
129
  body:
127
- encoding: US-ASCII
128
- string: ! '{"id":"PostCopyProject","name":"PostCopyProject","href":"/httpAuth/app/rest/projects/id:PostCopyProject","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PostCopyProject","parentProject":{"id":"_Root","name":"<Root
129
- project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PostCopyProject)"},"projects":{"project":[]}}'
130
+ encoding: UTF-8
131
+ string: '{"id":"PostCopyProject_2","name":"PostCopyProject","href":"/httpAuth/app/rest/projects/id:PostCopyProject_2","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PostCopyProject_2","parentProject":{"id":"_Root","name":"<Root
132
+ project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PostCopyProject_2)"},"projects":{"project":[]}}'
130
133
  http_version:
131
- recorded_at: Wed, 14 Aug 2013 02:17:53 GMT
134
+ recorded_at: Wed, 27 Nov 2013 20:29:37 GMT
132
135
  recorded_with: VCR 2.4.0
@@ -0,0 +1,134 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
6
+ body:
7
+ encoding: UTF-8
8
+ string: PutSetParentProject
9
+ headers:
10
+ User-Agent:
11
+ - TeamCity Ruby Client 1.1.0
12
+ Accept:
13
+ - application/json; charset=utf-8
14
+ Content-Type:
15
+ - text/plain
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=2E6ADC4C3CCCF8C6F835151D5D0AB8FE; 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 20:12:34 GMT
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"id":"PutSetParentProject","name":"PutSetParentProject","href":"/httpAuth/app/rest/projects/id:PutSetParentProject","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PutSetParentProject","parentProject":{"id":"_Root","name":"<Root
44
+ project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PutSetParentProject)"},"projects":{"project":[]}}'
45
+ http_version:
46
+ recorded_at: Wed, 27 Nov 2013 20:12:34 GMT
47
+ - request:
48
+ method: post
49
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects
50
+ body:
51
+ encoding: UTF-8
52
+ string: PutParentProject
53
+ headers:
54
+ User-Agent:
55
+ - TeamCity Ruby Client 1.1.0
56
+ Accept:
57
+ - application/json; charset=utf-8
58
+ Content-Type:
59
+ - text/plain
60
+ Accept-Encoding:
61
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
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=2BE939246A12318C13D0CFCD0C0D867C; 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, 27 Nov 2013 20:12:34 GMT
85
+ body:
86
+ encoding: UTF-8
87
+ string: '{"id":"PutParentProject","name":"PutParentProject","href":"/httpAuth/app/rest/projects/id:PutParentProject","description":"","archived":false,"webUrl":"http://localhost:8111/project.html?projectId=PutParentProject","parentProject":{"id":"_Root","name":"<Root
88
+ project>","href":"/httpAuth/app/rest/projects/id:_Root"},"buildTypes":{"buildType":[]},"templates":{"buildType":[]},"parameters":{"property":[]},"vcsRoots":{"href":"/httpAuth/app/rest/vcs-roots?locator=project:(id:PutParentProject)"},"projects":{"project":[]}}'
89
+ http_version:
90
+ recorded_at: Wed, 27 Nov 2013 20:12:34 GMT
91
+ - request:
92
+ method: put
93
+ uri: http://teamcity-ruby-client:teamcity@localhost:8111/httpAuth/app/rest/projects/PutSetParentProject/parentProject
94
+ body:
95
+ encoding: UTF-8
96
+ string: '{"id":"PutParentProject"}'
97
+ headers:
98
+ User-Agent:
99
+ - TeamCity Ruby Client 1.1.0
100
+ Accept:
101
+ - application/json; charset=utf-8
102
+ Content-Type:
103
+ - application/json
104
+ Accept-Encoding:
105
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ Server:
112
+ - Apache-Coyote/1.1
113
+ Set-Cookie:
114
+ - RememberMe=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly
115
+ - TCSESSIONID=82BA0B46E09E33C6CA272123B17D3208; Path=/; HttpOnly
116
+ Pragma:
117
+ - no-cache
118
+ Expires:
119
+ - Thu, 01 Jan 1970 00:00:00 GMT
120
+ Cache-Control:
121
+ - no-cache
122
+ - no-store
123
+ Content-Type:
124
+ - application/json
125
+ Transfer-Encoding:
126
+ - chunked
127
+ Date:
128
+ - Wed, 27 Nov 2013 20:12:34 GMT
129
+ body:
130
+ encoding: UTF-8
131
+ string: '{"id":"PutSetParentProject","name":"PutSetParentProject","href":"/httpAuth/app/rest/projects/id:PutSetParentProject"}'
132
+ http_version:
133
+ recorded_at: Wed, 27 Nov 2013 20:12:34 GMT
134
+ 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=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
@@ -1,4 +1,4 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe TeamCity::API do
4
4
  before do
@@ -138,7 +138,6 @@ describe 'BuildTypes' do
138
138
  end
139
139
 
140
140
  describe '.set_buildtype_field' do
141
-
142
141
  before(:each) do
143
142
  @buildtype_id = 'BuildTypeTests_PutSetBuildTypeField'
144
143
  end
@@ -162,6 +161,30 @@ describe 'BuildTypes' do
162
161
  end
163
162
  end
164
163
 
164
+ describe '.set_buildtype_setting' do
165
+ before(:each) do
166
+ @buildtype_id = 'BuildTypeTests_PutSetBuildTypeSettings'
167
+ end
168
+
169
+ it 'should set if it should perform clean builds' do
170
+ settings_name = 'cleanBuild'
171
+ settings_value = 'true'
172
+ @tc.set_buildtype_setting(@buildtype_id, settings_name, settings_value).should eq(settings_value)
173
+ end
174
+
175
+ it 'should set where the checkout happens when building' do
176
+ settings_name = 'checkoutMode'
177
+ settings_value = 'ON_AGENT'
178
+ @tc.set_buildtype_setting(@buildtype_id, settings_name, settings_value).should eq(settings_value)
179
+ end
180
+
181
+ it 'should set what is the timeout in minutes when executing builds' do
182
+ settings_name = 'executionTimeoutMin'
183
+ settings_value = '10'
184
+ @tc.set_buildtype_setting(@buildtype_id, settings_name, settings_value).should eq(settings_value)
185
+ end
186
+ end
187
+
165
188
  describe '.set_build_step_field' do
166
189
  before(:each) do
167
190
  @buildtype_id = 'BuildTypeTests_PutSetBuildStepField'
@@ -191,6 +214,17 @@ describe 'BuildTypes' do
191
214
  @buildtype_id = 'BuildTypeTests_PostBuildTypeTests'
192
215
  end
193
216
 
217
+ describe '.create_buildtype' do
218
+ it 'should create a build type' do
219
+ project_id = 'ProjectToTestBuildTypes'
220
+ buildtype_name = 'PostCreateBuildType'
221
+ buildtype_id = "#{project_id}_#{buildtype_name}"
222
+ @tc.create_project(project_id)
223
+ response = @tc.create_buildtype(project_id, buildtype_name)
224
+ response.id.should eq(buildtype_id)
225
+ end
226
+ end
227
+
194
228
  describe '.attach_vcs_root' do
195
229
  it 'should attach a vcs root to a buildtype' do
196
230
  vcs_root_id = 'teamcity_ruby_client'
@@ -208,6 +242,28 @@ describe 'BuildTypes' do
208
242
  response.id.should eq(parameter_name)
209
243
  end
210
244
  end
245
+
246
+ describe '.create_build_step' do
247
+ it 'should create a build step for a given build type' do
248
+ response = @tc.create_build_step(@buildtype_id, name: 'Unit Tests', type: 'Maven') do |properties|
249
+ properties['goals'] = 'verify'
250
+ properties['mavenSelection'] = 'mavenSelection:default'
251
+ properties['pomLocation'] = 'pom.xml'
252
+ end
253
+ response.name.should eq('Unit Tests')
254
+ end
255
+ end
256
+
257
+ describe '.create_build_trigger' do
258
+ it 'should create a build trigger for a given build type' do
259
+ response = @tc.create_build_trigger(@buildtype_id, type: 'vcsTrigger') do |properties|
260
+ properties['groupCheckkinsByCommitter'] = 'true'
261
+ properties['perCheckinTriggering'] = 'true'
262
+ properties['quietPeriodMode'] = 'DO_NOT_USE'
263
+ end
264
+ response.type.should eq('vcsTrigger')
265
+ end
266
+ end
211
267
  end
212
268
 
213
269
  describe 'DELETE', :vcr do
@@ -242,4 +298,4 @@ describe 'BuildTypes' do
242
298
  end
243
299
  end
244
300
  end
245
- end
301
+ end