Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
98c2f1ea
"README.rst" did not exist on "a4dd58cf5ee3ce8ce8de0728ce722c916f6c78fe"
Commit
98c2f1ea
authored
10 years ago
by
Paulus Schoutsen
Browse files
Options
Downloads
Patches
Plain Diff
Fix broken tests after API upgrade
parent
94d9cbf7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
homeassistant/components/http/__init__.py
+2
-1
2 additions, 1 deletion
homeassistant/components/http/__init__.py
homeassistant/remote.py
+1
-6
1 addition, 6 deletions
homeassistant/remote.py
homeassistant/test.py
+2
-12
2 additions, 12 deletions
homeassistant/test.py
with
5 additions
and
19 deletions
homeassistant/components/http/__init__.py
+
2
−
1
View file @
98c2f1ea
...
...
@@ -259,7 +259,8 @@ class RequestHandler(SimpleHTTPRequestHandler):
self
.
server
.
logger
.
exception
(
"
Exception parsing JSON: {}
"
.
format
(
body_content
))
self
.
send_response
(
HTTP_UNPROCESSABLE_ENTITY
)
self
.
_message
(
"
Error parsing JSON
"
,
HTTP_UNPROCESSABLE_ENTITY
)
return
else
:
data
.
update
({
key
:
value
[
-
1
]
for
key
,
value
in
...
...
This diff is collapsed.
Click to expand it.
homeassistant/remote.py
+
1
−
6
View file @
98c2f1ea
...
...
@@ -313,14 +313,9 @@ def get_event_listeners(api, logger=None):
return
{}
def
fire_event
(
api
,
event_type
,
event_
data
=
None
,
logger
=
None
):
def
fire_event
(
api
,
event_type
,
data
=
None
,
logger
=
None
):
"""
Fire an event at remote API.
"""
if
event_data
:
data
=
{
'
event_data
'
:
event_data
}
else
:
data
=
None
try
:
req
=
api
(
METHOD_POST
,
URL_API_EVENTS_EVENT
.
format
(
event_type
),
data
)
...
...
This diff is collapsed.
Click to expand it.
homeassistant/test.py
+
2
−
12
View file @
98c2f1ea
...
...
@@ -89,16 +89,6 @@ class TestHTTP(unittest.TestCase):
"""
things to be run when tests are started.
"""
cls
.
hass
=
ensure_homeassistant_started
()
def
test_debug_interface
(
self
):
"""
Test if we can login by comparing not logged in screen to
logged in screen.
"""
with_pw
=
requests
.
get
(
_url
(),
headers
=
HA_HEADERS
)
without_pw
=
requests
.
get
(
_url
())
self
.
assertNotEqual
(
without_pw
.
text
,
with_pw
.
text
)
def
test_api_password
(
self
):
"""
Test if we get access denied if we omit or provide
a wrong api password.
"""
...
...
@@ -210,7 +200,7 @@ class TestHTTP(unittest.TestCase):
requests
.
post
(
_url
(
remote
.
URL_API_EVENTS_EVENT
.
format
(
"
test_event_with_data
"
)),
data
=
json
.
dumps
(
{
"
event_data
"
:
{
"
test
"
:
1
}
}
),
data
=
json
.
dumps
({
"
test
"
:
1
}),
headers
=
HA_HEADERS
)
# Allow the event to take place
...
...
@@ -231,7 +221,7 @@ class TestHTTP(unittest.TestCase):
req
=
requests
.
post
(
_url
(
remote
.
URL_API_EVENTS_EVENT
.
format
(
"
test_event
"
)),
data
=
json
.
dumps
(
{
"
event_data
"
:
'
not an object
'
}
),
data
=
json
.
dumps
(
'
not an object
'
),
headers
=
HA_HEADERS
)
# It shouldn't but if it fires, allow the event to take place
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment