@@ -16,6 +16,25 @@ var nock = require('nock');
1616
1717module . exports = function ( ) {
1818
19+ //--------------------------------------------------------------------------------------
20+ //Simulate a 401 reply if api key is not sent
21+ nock ( 'http://localhost:80' )
22+ . post ( '/api/v3/projects/5/hooks' , {
23+ "url" : "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook" ,
24+ "push_events" : true
25+ } )
26+ . reply ( 401 , { "message" : "401 Unauthorized" } , {
27+ server : 'nginx' ,
28+ date : 'Fri, 21 Aug 2015 14:42:46 GMT' ,
29+ 'content-type' : 'application/json' ,
30+ 'content-length' : '30' ,
31+ connection : 'close' ,
32+ status : '401 Unauthorized' ,
33+ 'cache-control' : 'no-cache' ,
34+ 'x-request-id' : '052eafeb-0028-4e69-b951-95925efdc232' ,
35+ 'x-runtime' : '0.004600'
36+ } ) ;
37+
1938 //--------------------------------------------------------------------------------------
2039 //Simulate 201 replies when we request the addition of a new project
2140 //(adding hooks and keys)
@@ -71,25 +90,6 @@ module.exports = function () {
7190 'x-runtime' : '0.099567'
7291 } ) ;
7392
74- //--------------------------------------------------------------------------------------
75- //Simulate a 401 reply if api key is not sent
76- nock ( 'http://localhost:80' )
77- . post ( '/api/v3/projects/5/hooks' , {
78- "url" : "http://localhost:3000/stridertester/privproject1/api/gitlab/webhook" ,
79- "push_events" : true
80- } )
81- . reply ( 401 , { "message" : "401 Unauthorized" } , {
82- server : 'nginx' ,
83- date : 'Fri, 21 Aug 2015 14:42:46 GMT' ,
84- 'content-type' : 'application/json' ,
85- 'content-length' : '30' ,
86- connection : 'close' ,
87- status : '401 Unauthorized' ,
88- 'cache-control' : 'no-cache' ,
89- 'x-request-id' : '052eafeb-0028-4e69-b951-95925efdc232' ,
90- 'x-runtime' : '0.004600'
91- } ) ;
92-
9393 //--------------------------------------------------------------------------------------
9494 //Simulate a 404 if we passed an incorrect repo id
9595 nock ( 'http://localhost:80' )
0 commit comments