Add full state view for emulated_hue (apps using emulated_hue, 'sleep cycle' and 'sleep as android') (#26650)
* Add full state view for emulated_hue * clean and support updated sleep cycle * emulated hue add reuasable logic and cleanup code * emulated hue correct typos * Update hue_api.py * correct error message and update test_hue_api.py * cleanup test_hue_api.py
This commit is contained in:
1 parent
173966f459
commit
9ba9b3339b
4 files changed
+155
-9
No files matched your search
@@ -82,6 +82,31 @@ class TestEmulatedHue(unittest.TestCase):
|
||||
assert "success" in success_json
|
||||
assert "username" in success_json["success"]
|
||||
|
||||
def test_unauthorized_view(self):
|
||||
"""Test unauthorized view."""
|
||||
request_json = {"devicetype": "my_device"}
|
||||
|
||||
result = requests.get(
|
||||
BRIDGE_URL_BASE.format("/api/unauthorized"),
|
||||
data=json.dumps(request_json),
|
||||
timeout=5,
|
||||
)
|
||||
|
||||
assert result.status_code == 200
|
||||
assert "application/json" in result.headers["content-type"]
|
||||
|
||||
resp_json = result.json()
|
||||
assert len(resp_json) == 1
|
||||
success_json = resp_json[0]
|
||||
assert len(success_json) == 1
|
||||
|
||||
assert "error" in success_json
|
||||
error_json = success_json["error"]
|
||||
assert len(error_json) == 3
|
||||
assert "/" in error_json["address"]
|
||||
assert "unauthorized user" in error_json["description"]
|
||||
assert "1" in error_json["type"]
|
||||
|
||||
def test_valid_username_request(self):
|
||||
"""Test request with a valid username."""
|
||||
request_json = {"invalid_key": "my_device"}
|
||||
|
||||
Reference in new issue
Block a user