|
14 | 14 | from vws import VWS, CloudRecoService |
15 | 15 | from vws.exceptions.base_exceptions import CloudRecoException, VWSException |
16 | 16 | from vws.exceptions.cloud_reco_exceptions import ( |
| 17 | + InactiveProject, |
17 | 18 | MatchProcessing, |
18 | 19 | MaxNumResultsOutOfRange, |
19 | 20 | ) |
@@ -161,10 +162,7 @@ def test_target_name_exist( |
161 | 162 | assert exc.value.target_name == 'x' |
162 | 163 |
|
163 | 164 |
|
164 | | -def test_project_inactive( |
165 | | - vws_client: VWS, |
166 | | - high_quality_image: io.BytesIO, |
167 | | -) -> None: |
| 165 | +def test_project_inactive(high_quality_image: io.BytesIO) -> None: |
168 | 166 | """ |
169 | 167 | A ``ProjectInactive`` exception is raised if adding a target to an |
170 | 168 | inactive database. |
@@ -193,7 +191,20 @@ def test_project_inactive( |
193 | 191 |
|
194 | 192 | assert exc.value.response.status_code == HTTPStatus.FORBIDDEN |
195 | 193 |
|
196 | | - with pytest.raises(ProjectInactive) as exc: |
| 194 | +def test_inactive_project(high_quality_image: io.BytesIO) -> None: |
| 195 | + """ |
| 196 | + An ``InactiveProject`` exception is raised when querying an inactive |
| 197 | + database. |
| 198 | + """ |
| 199 | + database = VuforiaDatabase(state=States.PROJECT_INACTIVE) |
| 200 | + with MockVWS() as mock: |
| 201 | + mock.add_database(database=database) |
| 202 | + cloud_reco_client = CloudRecoService( |
| 203 | + client_access_key=database.client_access_key, |
| 204 | + client_secret_key=database.client_secret_key, |
| 205 | + ) |
| 206 | + |
| 207 | + with pytest.raises(InactiveProject) as exc: |
197 | 208 | cloud_reco_client.query(image=high_quality_image) |
198 | 209 |
|
199 | 210 | assert exc.value.response.status_code == HTTPStatus.FORBIDDEN |
|
0 commit comments