1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var nock = require('nock');
|
18 |
|
19 | module.exports = function () {
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | nock('http://localhost:80')
|
25 | .post('/api/v3/projects/5/hooks', {
|
26 | "url": "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook",
|
27 | "push_events": true
|
28 | })
|
29 | .query({"private_token": "zRtVsmeznn7ySatTrnrp"})
|
30 | .reply(201, {
|
31 | "id": 23,
|
32 | "url": "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook",
|
33 | "created_at": "2015-08-22T08:55:50.345Z",
|
34 | "project_id": 5,
|
35 | "push_events": true,
|
36 | "issues_events": false,
|
37 | "merge_requests_events": false,
|
38 | "tag_push_events": false
|
39 | }, {
|
40 | server: 'nginx',
|
41 | date: 'Sat, 22 Aug 2015 08:55:50 GMT',
|
42 | 'content-type': 'application/json',
|
43 | 'content-length': '235',
|
44 | connection: 'close',
|
45 | status: '201 Created',
|
46 | etag: '"3e1074f02f37c23c355cd1a33eecfb4b"',
|
47 | 'cache-control': 'max-age=0, private, must-revalidate',
|
48 | 'x-request-id': '3ccf26db-b72c-4b62-9b7b-42b307a85381',
|
49 | 'x-runtime': '0.031542'
|
50 | });
|
51 |
|
52 |
|
53 | nock('http://localhost:80')
|
54 | .post('/api/v3/projects/5/keys', {
|
55 | "title": "strider-stridertester/privproject1",
|
56 | "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1j1c3wNyUwFzIhU5ELZb6tH1K+TkQgV0CrYjRvWmeZZr5aNKehSo5ntCoPtjZOddD2qYOUNyqe0EkdsSa7JeuD0blk5T9V8EADxqSmfYE8qD3Ch1JN0T4gbxoH20N45gqfpzug04FNwaDvCoxJgKvJXNj141SRLVVsa3DlByqC1Il+6TS7LqsQQMnSahgdx6fOUSLzSRG5NmbHGnS4CA1W4zyqQKzznh/Qj9WLxQKxugly3PPWtlcCDoaFBBQSOIgGVs00Bd3X8DJW/3gNPfydtUAdm/BcDZHOLyBUNOQCjR/fGyLS8D4ufYt6vr72No9O0dyKyI+FpOb+jPDG631 stridertester/privproject1-stridertester@gmail.com\n"
|
57 | })
|
58 | .query({"private_token": "zRtVsmeznn7ySatTrnrp"})
|
59 | .reply(201, {
|
60 | "id": 24,
|
61 | "title": "strider-stridertester/privproject1",
|
62 | "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1j1c3wNyUwFzIhU5ELZb6tH1K+TkQgV0CrYjRvWmeZZr5aNKehSo5ntCoPtjZOddD2qYOUNyqe0EkdsSa7JeuD0blk5T9V8EADxqSmfYE8qD3Ch1JN0T4gbxoH20N45gqfpzug04FNwaDvCoxJgKvJXNj141SRLVVsa3DlByqC1Il+6TS7LqsQQMnSahgdx6fOUSLzSRG5NmbHGnS4CA1W4zyqQKzznh/Qj9WLxQKxugly3PPWtlcCDoaFBBQSOIgGVs00Bd3X8DJW/3gNPfydtUAdm/BcDZHOLyBUNOQCjR/fGyLS8D4ufYt6vr72No9O0dyKyI+FpOb+jPDG631 stridertester/privproject1-stridertester@gmail.com",
|
63 | "created_at": "2015-08-22T08:55:50.403Z"
|
64 | }, {
|
65 | server: 'nginx',
|
66 | date: 'Sat, 22 Aug 2015 08:55:50 GMT',
|
67 | 'content-type': 'application/json',
|
68 | 'content-length': '534',
|
69 | connection: 'close',
|
70 | status: '201 Created',
|
71 | etag: '"f5843bd3736577d1059f9390612e8f81"',
|
72 | 'cache-control': 'max-age=0, private, must-revalidate',
|
73 | 'x-request-id': '667866c3-47bb-408c-9569-f049ab7a21e6',
|
74 | 'x-runtime': '0.103697'
|
75 | });
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | nock('http://localhost:80')
|
81 | .post('/api/v3/projects/5/hooks', {
|
82 | "url": "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook",
|
83 | "push_events": true
|
84 | })
|
85 | .query({"private_token": "badkey"})
|
86 | .reply(401, {"message": "401 Unauthorized"}, {
|
87 | server: 'nginx',
|
88 | date: 'Sat, 22 Aug 2015 09:47:00 GMT',
|
89 | 'content-type': 'application/json',
|
90 | 'content-length': '30',
|
91 | connection: 'close',
|
92 | status: '401 Unauthorized',
|
93 | 'cache-control': 'no-cache',
|
94 | 'x-request-id': 'f31bd5f2-36cf-4cd6-9199-7ca70831da4d',
|
95 | 'x-runtime': '0.004801'
|
96 | });
|
97 |
|
98 | nock('http://localhost:80')
|
99 | .post('/api/v3/projects/5/keys', {
|
100 | "title": "strider-stridertester/privproject1",
|
101 | "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1j1c3wNyUwFzIhU5ELZb6tH1K+TkQgV0CrYjRvWmeZZr5aNKehSo5ntCoPtjZOddD2qYOUNyqe0EkdsSa7JeuD0blk5T9V8EADxqSmfYE8qD3Ch1JN0T4gbxoH20N45gqfpzug04FNwaDvCoxJgKvJXNj141SRLVVsa3DlByqC1Il+6TS7LqsQQMnSahgdx6fOUSLzSRG5NmbHGnS4CA1W4zyqQKzznh/Qj9WLxQKxugly3PPWtlcCDoaFBBQSOIgGVs00Bd3X8DJW/3gNPfydtUAdm/BcDZHOLyBUNOQCjR/fGyLS8D4ufYt6vr72No9O0dyKyI+FpOb+jPDG631 stridertester/privproject1-stridertester@gmail.com\n"
|
102 | })
|
103 | .query({"private_token": "badkey"})
|
104 | .reply(401, {"message": "401 Unauthorized"}, {
|
105 | server: 'nginx',
|
106 | date: 'Sat, 22 Aug 2015 09:47:00 GMT',
|
107 | 'content-type': 'application/json',
|
108 | 'content-length': '30',
|
109 | connection: 'close',
|
110 | status: '401 Unauthorized',
|
111 | 'cache-control': 'no-cache',
|
112 | 'x-request-id': '000fffa7-8aa6-46ed-a34a-7689f88d331f',
|
113 | 'x-runtime': '0.006122'
|
114 | });
|
115 |
|
116 |
|
117 |
|
118 | nock('http://localhost:80')
|
119 | .post('/api/v3/projects/invalidrepo/hooks', {
|
120 | "url": "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook",
|
121 | "push_events": true
|
122 | })
|
123 | .query({"private_token": "zRtVsmeznn7ySatTrnrp"})
|
124 | .reply(404, ["1f8b0800000000000003ab56ca4d2d2e4e4c4f55b252323130510828cacf4a4d2e51f0cb2f5170cb2fcd4b51aa050037095a2823000000"], {
|
125 | server: 'nginx',
|
126 | date: 'Sat, 22 Aug 2015 11:29:30 GMT',
|
127 | 'content-type': 'application/json',
|
128 | 'transfer-encoding': 'chunked',
|
129 | connection: 'close',
|
130 | status: '404 Not Found',
|
131 | 'cache-control': 'no-cache',
|
132 | 'x-request-id': '9d44eb7e-8a4d-4714-bd0a-5b4de958ed24',
|
133 | 'x-runtime': '0.005929',
|
134 | 'content-encoding': 'gzip'
|
135 | });
|
136 |
|
137 |
|
138 | nock('http://localhost:80')
|
139 | .post('/api/v3/projects/invalidrepo/keys', {
|
140 | "title": "strider-stridertester/privproject1",
|
141 | "key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1j1c3wNyUwFzIhU5ELZb6tH1K+TkQgV0CrYjRvWmeZZr5aNKehSo5ntCoPtjZOddD2qYOUNyqe0EkdsSa7JeuD0blk5T9V8EADxqSmfYE8qD3Ch1JN0T4gbxoH20N45gqfpzug04FNwaDvCoxJgKvJXNj141SRLVVsa3DlByqC1Il+6TS7LqsQQMnSahgdx6fOUSLzSRG5NmbHGnS4CA1W4zyqQKzznh/Qj9WLxQKxugly3PPWtlcCDoaFBBQSOIgGVs00Bd3X8DJW/3gNPfydtUAdm/BcDZHOLyBUNOQCjR/fGyLS8D4ufYt6vr72No9O0dyKyI+FpOb+jPDG631 stridertester/privproject1-stridertester@gmail.com\n"
|
142 | })
|
143 | .query({"private_token": "zRtVsmeznn7ySatTrnrp"})
|
144 | .reply(404, ["1f8b0800000000000003ab56ca4d2d2e4e4c4f55b252323130510828cacf4a4d2e51f0cb2f5170cb2fcd4b51aa050037095a2823000000"], {
|
145 | server: 'nginx',
|
146 | date: 'Sat, 22 Aug 2015 11:29:30 GMT',
|
147 | 'content-type': 'application/json',
|
148 | 'transfer-encoding': 'chunked',
|
149 | connection: 'close',
|
150 | status: '404 Not Found',
|
151 | 'cache-control': 'no-cache',
|
152 | 'x-request-id': 'f78f974c-207b-4d85-b42a-3c38dea668e7',
|
153 | 'x-runtime': '0.006760',
|
154 | 'content-encoding': 'gzip'
|
155 | });
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 | nock('http://localhost:80')
|
162 | .post('/api/v3/projects/5/hooks', {
|
163 | "url": "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook",
|
164 | "push_events": true
|
165 | })
|
166 | .query({"private_token": "zRtVsmeznn7ySatTrnrp"})
|
167 | .reply(201, {
|
168 | "id": 27,
|
169 | "url": "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook",
|
170 | "created_at": "2015-08-22T11:31:48.159Z",
|
171 | "project_id": 5,
|
172 | "push_events": true,
|
173 | "issues_events": false,
|
174 | "merge_requests_events": false,
|
175 | "tag_push_events": false
|
176 | }, {
|
177 | server: 'nginx',
|
178 | date: 'Sat, 22 Aug 2015 11:31:48 GMT',
|
179 | 'content-type': 'application/json',
|
180 | 'content-length': '235',
|
181 | connection: 'close',
|
182 | status: '201 Created',
|
183 | etag: '"ae205f292720e19ab273c3bea2ba66b0"',
|
184 | 'cache-control': 'max-age=0, private, must-revalidate',
|
185 | 'x-request-id': '4562483b-5c3d-4f19-bf63-bb3968c39815',
|
186 | 'x-runtime': '0.023564'
|
187 | });
|
188 |
|
189 | nock('http://localhost:80')
|
190 | .post('/api/v3/projects/5/keys', {"title": "strider-stridertester/privproject1", "key": "invalid key"})
|
191 | .query({"private_token": "zRtVsmeznn7ySatTrnrp"})
|
192 | .reply(400, {"message": {"key": ["is invalid"], "fingerprint": ["cannot be generated"]}}, {
|
193 | server: 'nginx',
|
194 | date: 'Sat, 22 Aug 2015 11:31:48 GMT',
|
195 | 'content-type': 'application/json',
|
196 | 'content-length': '72',
|
197 | connection: 'close',
|
198 | status: '400 Bad Request',
|
199 | 'cache-control': 'no-cache',
|
200 | 'x-request-id': 'be0ac084-2fae-4589-b4a7-13a65cc0f055',
|
201 | 'x-runtime': '0.074954'
|
202 | });
|
203 | };
|