Skip to content

Rename MatchProcessing to DeletedTargetMatched #1058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mock_vws/_flask_server/vwq.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
)
from mock_vws._query_validators import run_query_validators
from mock_vws._query_validators.exceptions import (
MatchProcessing,
DeletedTargetMatched,
ValidatorException,
)
from mock_vws.database import VuforiaDatabase
Expand Down Expand Up @@ -124,7 +124,7 @@ def query() -> Response:
),
)
except ActiveMatchingTargetsDeleteProcessing as exc:
raise MatchProcessing from exc
raise DeletedTargetMatched from exc

headers = {
'Content-Type': 'application/json',
Expand Down
11 changes: 5 additions & 6 deletions src/mock_vws/_query_validators/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,9 @@ def __init__(self) -> None:
}


class MatchProcessing(ValidatorException):
class DeletedTargetMatched(ValidatorException):
"""
Exception raised a target is matched which is processing or recently
deleted.
Exception raised when target which was recently deleted is matched.
"""

def __init__(self) -> None:
Expand All @@ -682,9 +681,9 @@ def __init__(self) -> None:
# * Do the most unexpected thing.
# * Be consistent with every response.
resources_dir = Path(__file__).parent.parent / 'resources'
filename = 'match_processing_response.html'
match_processing_resp_file = resources_dir / filename
self.response_text = Path(match_processing_resp_file).read_text(
filename = 'deleted_target_matched_response.html'
deleted_target_matched_resp_file = resources_dir / filename
self.response_text = Path(deleted_target_matched_resp_file).read_text(
encoding='utf-8',
)
self.headers = {
Expand Down
10 changes: 5 additions & 5 deletions src/mock_vws/_requests_mock_server/mock_web_query_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
from mock_vws._query_validators import run_query_validators
from mock_vws._query_validators.exceptions import (
MatchProcessing,
DeletedTargetMatched,
ValidatorException,
)
from mock_vws.target_manager import TargetManager
Expand Down Expand Up @@ -138,10 +138,10 @@ def query(
),
)
except ActiveMatchingTargetsDeleteProcessing:
match_processing_exception = MatchProcessing()
context.headers = match_processing_exception.headers
context.status_code = match_processing_exception.status_code
return match_processing_exception.response_text
deleted_target_matched_exception = DeletedTargetMatched()
context.headers = deleted_target_matched_exception.headers
context.status_code = deleted_target_matched_exception.status_code
return deleted_target_matched_exception.response_text

date = email.utils.formatdate(None, localtime=False, usegmt=True)
context.headers = {
Expand Down