@@ -45,18 +45,18 @@ def test_app(self):
4545 """
4646 Test that a user can create, read, update and delete an application
4747 """
48- url = '/api /apps'
48+ url = '/v1 /apps'
4949 response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
5050 self .assertEqual (response .status_code , 201 )
5151 app_id = response .data ['id' ] # noqa
5252 self .assertIn ('id' , response .data )
5353 self .assertIn ('url' , response .data )
5454 self .assertEqual (response .data ['url' ], '{app_id}.deisapp.local' .format (** locals ()))
55- response = self .client .get ('/api /apps' ,
55+ response = self .client .get ('/v1 /apps' ,
5656 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
5757 self .assertEqual (response .status_code , 200 )
5858 self .assertEqual (len (response .data ['results' ]), 1 )
59- url = '/api /apps/{app_id}' .format (** locals ())
59+ url = '/v1 /apps/{app_id}' .format (** locals ())
6060 response = self .client .get (url ,
6161 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
6262 self .assertEqual (response .status_code , 200 )
@@ -70,19 +70,19 @@ def test_app(self):
7070
7171 def test_app_override_id (self ):
7272 body = {'id' : 'myid' }
73- response = self .client .post ('/api /apps' , json .dumps (body ),
73+ response = self .client .post ('/v1 /apps' , json .dumps (body ),
7474 content_type = 'application/json' ,
7575 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
7676 self .assertEqual (response .status_code , 201 )
7777 body = {'id' : response .data ['id' ]}
78- response = self .client .post ('/api /apps' , json .dumps (body ),
78+ response = self .client .post ('/v1 /apps' , json .dumps (body ),
7979 content_type = 'application/json' ,
8080 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
8181 self .assertContains (response , 'App with this Id already exists.' , status_code = 400 )
8282 return response
8383
8484 def test_app_actions (self ):
85- url = '/api /apps'
85+ url = '/v1 /apps'
8686 body = {'id' : 'autotest' }
8787 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
8888 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
@@ -95,7 +95,7 @@ def test_app_actions(self):
9595 # HACK: remove app lifecycle logs
9696 if os .path .exists (path ):
9797 os .remove (path )
98- url = '/api /apps/{app_id}/logs' .format (** locals ())
98+ url = '/v1 /apps/{app_id}/logs' .format (** locals ())
9999 response = self .client .get (url ,
100100 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
101101 self .assertEqual (response .status_code , 204 )
@@ -112,14 +112,14 @@ def test_app_actions(self):
112112
113113 def test_app_release_notes_in_logs (self ):
114114 """Verifies that an app's release summary is dumped into the logs."""
115- url = '/api /apps'
115+ url = '/v1 /apps'
116116 body = {'id' : 'autotest' }
117117 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
118118 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
119119 self .assertEqual (response .status_code , 201 )
120120 app_id = response .data ['id' ] # noqa
121121 path = os .path .join (settings .DEIS_LOG_DIR , app_id + '.log' )
122- url = '/api /apps/{app_id}/logs' .format (** locals ())
122+ url = '/v1 /apps/{app_id}/logs' .format (** locals ())
123123 response = self .client .get (url ,
124124 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
125125 self .assertIn ('autotest created initial release' , response .data )
@@ -129,12 +129,12 @@ def test_app_release_notes_in_logs(self):
129129
130130 def test_app_errors (self ):
131131 app_id = 'autotest-errors'
132- url = '/api /apps'
132+ url = '/v1 /apps'
133133 body = {'id' : 'camelCase' }
134134 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
135135 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
136136 self .assertContains (response , 'App IDs can only contain [a-z0-9-]' , status_code = 400 )
137- url = '/api /apps'
137+ url = '/v1 /apps'
138138 body = {'id' : 'deis' }
139139 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
140140 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
@@ -144,19 +144,19 @@ def test_app_errors(self):
144144 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
145145 self .assertEqual (response .status_code , 201 )
146146 app_id = response .data ['id' ] # noqa
147- url = '/api /apps/{app_id}' .format (** locals ())
147+ url = '/v1 /apps/{app_id}' .format (** locals ())
148148 response = self .client .delete (url ,
149149 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
150150 self .assertEquals (response .status_code , 204 )
151151 for endpoint in ('containers' , 'config' , 'releases' , 'builds' ):
152- url = '/api /apps/{app_id}/{endpoint}' .format (** locals ())
152+ url = '/v1 /apps/{app_id}/{endpoint}' .format (** locals ())
153153 response = self .client .get (url ,
154154 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
155155 self .assertEquals (response .status_code , 404 )
156156
157157 def test_app_structure_is_valid_json (self ):
158158 """Application structures should be valid JSON objects."""
159- url = '/api /apps'
159+ url = '/v1 /apps'
160160 response = self .client .post (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
161161 self .assertEqual (response .status_code , 201 )
162162 app_id = response .data ['id' ]
@@ -165,7 +165,7 @@ def test_app_structure_is_valid_json(self):
165165 app = App .objects .get (id = app_id )
166166 app .structure = {'web' : 1 }
167167 app .save ()
168- url = '/api /apps/{}' .format (app_id )
168+ url = '/v1 /apps/{}' .format (app_id )
169169 response = self .client .get (url , HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
170170 self .assertIn ('structure' , response .data )
171171 self .assertEqual (response .data ['structure' ], {"web" : 1 })
@@ -178,25 +178,25 @@ def test_admin_can_manage_other_apps(self):
178178 user = User .objects .get (username = 'autotest2' )
179179 token = Token .objects .get (user = user )
180180 app_id = 'autotest'
181- url = '/api /apps'
181+ url = '/v1 /apps'
182182 body = {'id' : app_id }
183183 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
184184 HTTP_AUTHORIZATION = 'token {}' .format (token ))
185185 app = App .objects .get (id = app_id )
186186 # log in as admin, check to see if they have access
187- url = '/api /apps/{}' .format (app_id )
187+ url = '/v1 /apps/{}' .format (app_id )
188188 response = self .client .get (url ,
189189 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
190190 self .assertEqual (response .status_code , 200 )
191191 # check app logs
192- url = '/api /apps/{app_id}/logs' .format (** locals ())
192+ url = '/v1 /apps/{app_id}/logs' .format (** locals ())
193193 response = self .client .get (url ,
194194 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
195195 self .assertEqual (response .status_code , 200 )
196196 self .assertIn ('autotest2 created initial release' , response .data )
197197 # TODO: test run needs an initial build
198198 # delete the app
199- url = '/api /apps/{}' .format (app_id )
199+ url = '/v1 /apps/{}' .format (app_id )
200200 response = self .client .delete (url ,
201201 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
202202 self .assertEqual (response .status_code , 204 )
@@ -209,7 +209,7 @@ def test_admin_can_see_other_apps(self):
209209 user = User .objects .get (username = 'autotest2' )
210210 token = Token .objects .get (user = user )
211211 app_id = 'autotest'
212- url = '/api /apps'
212+ url = '/v1 /apps'
213213 body = {'id' : app_id }
214214 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
215215 HTTP_AUTHORIZATION = 'token {}' .format (token ))
@@ -221,14 +221,14 @@ def test_run_without_auth(self):
221221 """If the administrator has not provided SSH private key for run commands,
222222 make sure a friendly error message is provided on run"""
223223 settings .SSH_PRIVATE_KEY = ''
224- url = '/api /apps'
224+ url = '/v1 /apps'
225225 body = {'id' : 'autotest' }
226226 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
227227 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
228228 self .assertEqual (response .status_code , 201 )
229229 app_id = response .data ['id' ] # noqa
230230 # test run
231- url = '/api /apps/{app_id}/run' .format (** locals ())
231+ url = '/v1 /apps/{app_id}/run' .format (** locals ())
232232 body = {'command' : 'ls -al' }
233233 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
234234 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
@@ -241,11 +241,11 @@ def test_run_without_release_should_error(self):
241241 is present.
242242 """
243243 app_id = 'autotest'
244- url = '/api /apps'
244+ url = '/v1 /apps'
245245 body = {'id' : app_id }
246246 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
247247 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
248- url = '/api /apps/{}/run' .format (app_id )
248+ url = '/v1 /apps/{}/run' .format (app_id )
249249 body = {'command' : 'ls -al' }
250250 response = self .client .post (url , json .dumps (body ), content_type = 'application/json' ,
251251 HTTP_AUTHORIZATION = 'token {}' .format (self .token ))
0 commit comments