@@ -192,6 +192,30 @@ def test_build_hook(self):
192192 self .assertIn ('release' , response .data )
193193 self .assertIn ('version' , response .data ['release' ])
194194
195+ @mock .patch ('requests.post' , mock_status_ok )
196+ def test_build_hook_slug_url (self ):
197+ """Test creating a slug_url build via an API Hook"""
198+ url = '/v2/apps'
199+ response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
200+ self .assertEqual (response .status_code , 201 )
201+ app_id = response .data ['id' ]
202+ build = {'username' : 'autotest' , 'app' : app_id }
203+ url = '/v2/hooks/builds' .format (** locals ())
204+ body = {'receive_user' : 'autotest' ,
205+ 'receive_repo' : app_id ,
206+ 'image' : 'http://example.com/slugs/foo-12345354.tar.gz' }
207+
208+ # post the build without an auth token
209+ response = self .client .post (url , json .dumps (body ), content_type = 'application/json' )
210+ self .assertEqual (response .status_code , 401 )
211+
212+ # post the build with the builder auth key
213+ response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
214+ HTTP_X_DEIS_BUILDER_AUTH = settings .BUILDER_KEY )
215+ self .assertEqual (response .status_code , 200 )
216+ self .assertIn ('release' , response .data )
217+ self .assertIn ('version' , response .data ['release' ])
218+
195219 def test_build_hook_procfile (self ):
196220 """Test creating a Procfile build via an API Hook"""
197221 url = '/v2/apps'
0 commit comments