Improve service validation exception test and translation key (#115843)

* Small improvement to service validation exception test and translation key

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Refactor string assertion

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Jan Bouwhuis 2024-04-21 08:54:23 +02:00 committed by GitHub
parent 27bccf0b24
commit b592225a87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -192,7 +192,7 @@
"service_not_found": { "service_not_found": {
"message": "Service {domain}.{service} not found." "message": "Service {domain}.{service} not found."
}, },
"service_does_not_supports_reponse": { "service_does_not_support_response": {
"message": "A service which does not return responses can't be called with {return_response}." "message": "A service which does not return responses can't be called with {return_response}."
}, },
"service_lacks_response_request": { "service_lacks_response_request": {

View file

@ -2589,7 +2589,7 @@ class ServiceRegistry:
if handler.supports_response is SupportsResponse.NONE: if handler.supports_response is SupportsResponse.NONE:
raise ServiceValidationError( raise ServiceValidationError(
translation_domain=DOMAIN, translation_domain=DOMAIN,
translation_key="service_does_not_supports_reponse", translation_key="service_does_not_support_response",
translation_placeholders={ translation_placeholders={
"return_response": "return_response=True" "return_response": "return_response=True"
}, },

View file

@ -1803,9 +1803,9 @@ async def test_services_call_return_response_requires_blocking(
blocking=False, blocking=False,
return_response=True, return_response=True,
) )
assert ( assert str(exc.value) == (
str(exc.value) "A non blocking service call with argument blocking=False "
== "A non blocking service call with argument blocking=False can't be used together with argument return_response=True" "can't be used together with argument return_response=True"
) )