Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #39 from richtier/fix-no-content
Browse files Browse the repository at this point in the history
Fix synchronise device state
  • Loading branch information
Richard Tier authored Oct 28, 2019
2 parents b423d0d + b8ef50b commit 39f6b9e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
name: run tests
command: |
. venv/bin/activate
make lint
make test
flake8
pytest
- run:
name: report coverage
command: |
Expand Down
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
exclude=.venv,venv,snowboy,build
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Changelog

## 1.4.1
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/34)
### Implemented enhancements
- Simplified makefile. Use direct `flake8` and `pytest` commands instead of `make lint` and `make test`.
- Add CHANGELOG.md

### Fixed bugs
- Fixed synchronise state incorrectly using `GET` method.

## 1.4.0
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/33)
### Implemented enhancements
- Add Automatic Speech Recognition (ASR) profile support, optimized for user speech from varying distances.

## 1.3.0
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/31)
### Implemented enhancements
- Renamed package from avs_client to alexa_client
- Use thread timer for ping management
- Add ExpectSpeech directive

## 1.2.0
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/29)
### Implemented enhancements
- Support dialogue request id to support multi-step commands.
- Added streaming audio example

### Fixed bugs

## 1.1.0
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/28)
### Implemented enhancements
- Added support for HandlePlay directive

## 1.0.0
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/23)
### Implemented enhancements
- Handle multi-part responses
- Removed type hinting
- Added makefile

## 0.7.1
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/16)
### Implemented enhancements
- Remove requirements.txt - hard-code in setup.py instead

### Fixed bugs
- Fix incorrect callback url generation #16

## 0.6.0
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/12)
### Implemented enhancements
- Add AmazonOauth2RequestManager

## 0.5.2
[Full Changelog](https://github.com/richtier/alexa-voice-service-client/pull/6)

### Fixed bugs
- Expect 204 or 200 on synchronise device state
17 changes: 1 addition & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,4 @@ test_requirements:
pip install -e .[test]


lint:
flake8 --exclude=.venv,venv,snowboy,build


test:
pytest $1 \
--ignore=venv \
--ignore=.venv \
--ignore=build \
--cov=./ \
--cov-config=.coveragerc \
--capture=no \
--last-failed \
-vv

.PHONY: build publish_test publish test_requirements test
.PHONY: build publish_test publish test_requirements
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ To run the unit tests, call the following commands:
```sh
git clone [email protected]:richtier/alexa-voice-service-client.git
make test_requirements
make test
pytest
```

## Other projects ##
Expand Down
4 changes: 2 additions & 2 deletions alexa_client/alexa_client/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ def synchronise_device_state(self, device_state, authentication_headers):
'Content-Type': multipart_data.content_type
}
stream_id = self.connection.request(
'GET',
'POST',
'/v20160207/events',
body=multipart_data,
headers=headers,
)
response = self.connection.get_response(stream_id)
assert response.status in [http.client.NO_CONTENT, http.client.OK]
assert response.status == http.client.NO_CONTENT

def send_audio_file(
self, audio_file, device_state, authentication_headers,
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts= --ignore=venv --ignore=.venv --ignore=build --cov=./ --cov-config=.coveragerc --capture=no --last-failed -vv
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='alexa_client',
version='1.4.0',
version='1.4.1',
packages=find_packages(exclude=["tests.*", "tests"]),
url='https://github.com/richtier/alexa-voice-service-client',
license='MIT',
Expand Down
7 changes: 3 additions & 4 deletions tests/alexa_client/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ def test_establish_downstream_conncetion(manager, authentication_headers):
}


@pytest.mark.parametrize("status", [200, 204])
def test_synchronise_device_state(
status, manager, authentication_headers, device_state
manager, authentication_headers, device_state
):
manager.create_connection()
manager.mock_response(status_code=status)
manager.mock_response(status_code=204)

manager.synchronise_device_state(
authentication_headers=authentication_headers,
Expand All @@ -96,7 +95,7 @@ def test_synchronise_device_state(
headers = dict(list(manager.connection.recent_stream.headers.items()))

assert headers == {
b':method': b'GET',
b':method': b'POST',
b':scheme': b'https',
b':authority': b'avs-alexa-eu.amazon.com',
b':path': b'/v20160207/events',
Expand Down

0 comments on commit 39f6b9e

Please sign in to comment.