From 98938d35de71b8254ff68a6d53192c6941af8db3 Mon Sep 17 00:00:00 2001 From: richtier Date: Mon, 13 Jan 2020 08:05:01 +0000 Subject: [PATCH] Handle 204 and 200 responses on synchronise device state --- CHANGELOG.md | 5 +++++ alexa_client/alexa_client/connection.py | 2 +- setup.py | 2 +- tests/alexa_client/test_connection.py | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4355f..1112601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.5.1 +[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/46) +### Fixed bugs +- Handle 204 and 200 responses on synchronise device state + ## 1.5.0 [Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/35) ### Implemented enhancements diff --git a/alexa_client/alexa_client/connection.py b/alexa_client/alexa_client/connection.py index 61cd291..114e695 100644 --- a/alexa_client/alexa_client/connection.py +++ b/alexa_client/alexa_client/connection.py @@ -73,7 +73,7 @@ def synchronise_device_state(self, device_state, authentication_headers): headers=headers, ) response = self.connection.get_response(stream_id) - assert response.status == http.client.NO_CONTENT + assert response.status in (http.client.NO_CONTENT, http.client.OK) def send_audio_file( self, audio_file, device_state, authentication_headers, diff --git a/setup.py b/setup.py index c583784..73c966b 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='alexa_client', - version='1.5.0', + version='1.5.1', packages=find_packages(exclude=["tests.*", "tests"]), url='https://github.com/richtier/alexa-voice-service-client', license='MIT', diff --git a/tests/alexa_client/test_connection.py b/tests/alexa_client/test_connection.py index c462169..d6bb1d2 100644 --- a/tests/alexa_client/test_connection.py +++ b/tests/alexa_client/test_connection.py @@ -87,11 +87,12 @@ def test_establish_downstream_conncetion(manager, authentication_headers): } +@pytest.mark.parametrize("status_code", [200, 204]) def test_synchronise_device_state( - manager, authentication_headers, device_state + manager, authentication_headers, device_state, status_code ): manager.create_connection() - manager.mock_response(status_code=204) + manager.mock_response(status_code=status_code) manager.synchronise_device_state( authentication_headers=authentication_headers,