File tree Expand file tree Collapse file tree 4 files changed +37
-16
lines changed
Expand file tree Collapse file tree 4 files changed +37
-16
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,21 @@ def response(self) -> Response:
203203 return self ._response
204204
205205
206+ class TargetStatusNotSuccess (Exception ):
207+ """
208+ Exception raised when Vuforia returns a response with a result code
209+ 'TargetStatusNotSuccess'.
210+ """
211+
212+ def __init__ (self , response : Response ) -> None :
213+ """
214+ Args:
215+ response: The response to a request to Vuforia.
216+ """
217+ super ().__init__ ()
218+ self .response = response
219+
220+
206221class TargetProcessingTimeout (Exception ):
207222 """
208223 Exception raised when waiting for a target to be processed times out.
Original file line number Diff line number Diff line change 2424 TargetNameExist ,
2525 TargetProcessingTimeout ,
2626 TargetStatusProcessing ,
27+ TargetStatusNotSuccess ,
2728 UnknownTarget ,
2829)
2930
@@ -111,6 +112,7 @@ def _raise_for_result_code(
111112 'ProjectInactive' : ProjectInactive ,
112113 'TargetNameExist' : TargetNameExist ,
113114 'TargetStatusProcessing' : TargetStatusProcessing ,
115+ 'TargetStatusNotSuccess' : TargetStatusNotSuccess ,
114116 'UnknownTarget' : UnknownTarget ,
115117 }[result_code ]
116118
Original file line number Diff line number Diff line change 2121 MetadataTooLarge ,
2222 ProjectInactive ,
2323 TargetNameExist ,
24+ TargetStatusNotSuccess ,
2425 TargetStatusProcessing ,
2526 UnknownTarget ,
2627)
@@ -225,3 +226,22 @@ def test_authentication_failure(high_quality_image: io.BytesIO) -> None:
225226 )
226227
227228 assert exc .value .response .status_code == codes .UNAUTHORIZED
229+
230+ def test_target_status_not_success (
231+ client : VWS ,
232+ high_quality_image : io .BytesIO ,
233+ ) -> None :
234+ """
235+ A ``TargetStatusNotSuccess`` exception is raised when updating a target
236+ which has a status which is not "Success".
237+ """
238+ target_id = client .add_target (
239+ name = 'x' ,
240+ width = 1 ,
241+ image = high_quality_image ,
242+ )
243+
244+ with pytest .raises (TargetStatusNotSuccess ) as exc :
245+ client .update_target (target_id = target_id )
246+
247+ assert exc .value .response .status_code == codes .FORBIDDEN
Original file line number Diff line number Diff line change @@ -452,22 +452,6 @@ def test_update_target(
452452 client .wait_for_target_processed (target_id = target_id )
453453 client .update_target (target_id = target_id )
454454
455- def test_target_status_not_success (
456- self ,
457- client : VWS ,
458- high_quality_image : io .BytesIO ,
459- ) -> None :
460- """
461- It is possible to update a target.
462- """
463- target_id = client .add_target (
464- name = 'x' ,
465- width = 1 ,
466- image = high_quality_image ,
467- )
468- client .wait_for_target_processed (target_id = target_id )
469- client .update_target (target_id = target_id )
470-
471455 def test_no_fields_given (
472456 self ,
473457 client : VWS ,
You can’t perform that action at this time.
0 commit comments