-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update lock alias * Add unit tests * Add integration tests * Add end-to-end tests * Update docs * Fix typo
- Loading branch information
Hoanh An
authored
Nov 27, 2018
1 parent
91d1947
commit 774d576
Showing
7 changed files
with
426 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 1.0 | ||
locations: | ||
- name: r1vec | ||
rack: | ||
name: rack-1 | ||
board: | ||
name: vec | ||
devices: | ||
- name: lock | ||
metadata: | ||
model: emul8-lock | ||
outputs: | ||
- type: lock.state | ||
instances: | ||
- info: Synse Door Lock | ||
location: r1vec | ||
data: | ||
id: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Test the 'synse.routes.aliases' module's lock route.""" | ||
# pylint: disable=redefined-outer-name,unused-argument | ||
|
||
from synse import errors | ||
from synse.version import __api_version__ | ||
from tests import utils | ||
|
||
invalid_lock_route_url = '/synse/{}/lock/invalid-rack/invalid-board/invalid-device'.format(__api_version__) | ||
|
||
|
||
def test_lock_endpoint_invalid(app): | ||
"""Get lock info for a nonexistent device.""" | ||
_, response = app.test_client.get(invalid_lock_route_url) | ||
utils.test_error_json(response, errors.DEVICE_NOT_FOUND, 404) | ||
|
||
|
||
def test_lock_endpoint_post_not_allowed(app): | ||
"""Invalid request: POST""" | ||
_, response = app.test_client.post(invalid_lock_route_url) | ||
assert response.status == 405 | ||
|
||
|
||
def test_lock_endpoint_put_not_allowed(app): | ||
"""Invalid request: PUT""" | ||
_, response = app.test_client.put(invalid_lock_route_url) | ||
assert response.status == 405 | ||
|
||
|
||
def test_lock_endpoint_delete_not_allowed(app): | ||
"""Invalid request: DELETE""" | ||
_, response = app.test_client.delete(invalid_lock_route_url) | ||
assert response.status == 405 | ||
|
||
|
||
def test_lock_endpoint_patch_not_allowed(app): | ||
"""Invalid request: PATCH""" | ||
_, response = app.test_client.patch(invalid_lock_route_url) | ||
assert response.status == 405 | ||
|
||
|
||
def test_lock_endpoint_head_not_allowed(app): | ||
"""Invalid request: HEAD""" | ||
_, response = app.test_client.head(invalid_lock_route_url) | ||
assert response.status == 405 | ||
|
||
|
||
def test_lock_endpoint_options_not_allowed(app): | ||
"""Invalid request: OPTIONS""" | ||
_, response = app.test_client.options(invalid_lock_route_url) | ||
assert response.status == 405 |
Oops, something went wrong.