-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from connorgallopo/hass-actions
Lint code and add HACS workflow
- Loading branch information
Showing
23 changed files
with
474 additions
and
479 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 @@ | ||
name: Validate | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
validate-hacs: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- name: HACS validation | ||
uses: "hacs/action@main" | ||
with: | ||
category: "integration" |
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
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
{ | ||
"domain": "leslies_pool", | ||
"name": "Leslie's Pool Water Tests", | ||
"codeowners": ["@connorgallopo"], | ||
"config_flow": true, | ||
"dependencies": [], | ||
"documentation": "https://github.com/connorgallopo/leslies-pool", | ||
"iot_class": "cloud_polling", | ||
"issue_tracker": "https://github.com/connorgallopo/leslies-pool/issues", | ||
"dependencies": [], | ||
"config_flow": true, | ||
"codeowners": ["@connorgallopo"], | ||
"requirements": ["beautifulsoup4==4.12.3", "requests==2.31.0"], | ||
"version": "1.0.0" | ||
} |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
beautifulsoup4==4.12.3 | ||
requests==2.31.0 | ||
requests==2.31.0 |
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 |
---|---|---|
@@ -1,27 +1,21 @@ | ||
{ | ||
"config": { | ||
"error": { | ||
"invalid_auth": "Authentication failed.", | ||
"invalid_url": "The provided URL is invalid.", | ||
"unknown": "An unknown error occurred." | ||
}, | ||
"step": { | ||
"user": { | ||
"data": { | ||
"password": "Password", | ||
"scan_interval": "Polling Interval (seconds)", | ||
"username": "Username", | ||
"water_test_url": "Water Test URL" | ||
}, | ||
"description": "Set up your Leslie's Pool integration.", | ||
"description_placeholders": { | ||
"password": "Enter your password", | ||
"scan_interval": "300", | ||
"username": "Enter your username", | ||
"water_test_url": "https://lesliespool.com/on/demandware.store/Sites-lpm_site-Site/en_US/WaterTest-Landing?poolProfileId=XXXX&poolName=XXXX" | ||
}, | ||
"title": "Leslie's Pool Water Tests" | ||
} | ||
"error": { | ||
"invalid_auth": "Authentication failed.", | ||
"invalid_url": "The provided URL is invalid.", | ||
"unknown": "An unknown error occurred." | ||
}, | ||
"step": { | ||
"user": { | ||
"data": { | ||
"password": "Password", | ||
"scan_interval": "Polling Interval (seconds)", | ||
"username": "Username", | ||
"water_test_url": "Water Test URL" | ||
}, | ||
"description": "Set up your Leslie's Pool integration.", | ||
"title": "Leslie's Pool Water Tests" | ||
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
{ | ||
"name": "Leslie's Pool Water Tests", | ||
"hacs": "1.6.0", | ||
"domains": ["sensor"], | ||
"iot_class": "Cloud Polling", | ||
"homeassistant": "0.118.0" | ||
} |
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
beautifulsoup4==4.12.3 | ||
requests==2.31.0 | ||
requests==2.31.0 | ||
black==22.3.0 | ||
click==8.0.4 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
"""Tests for leslies_pool integration.""" | ||
"""Tests for the Leslie's Pool Water Tests integration.""" |
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 |
---|---|---|
@@ -1,39 +1,15 @@ | ||
"""Global fixtures for leslies_pool integration.""" | ||
"""Common fixtures for the Leslie's Pool Water Tests tests.""" | ||
from collections.abc import Generator | ||
from unittest.mock import AsyncMock | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
pytest_plugins = "pytest_homeassistant_custom_component" | ||
|
||
|
||
# This fixture is used to prevent HomeAssistant from attempting to create and dismiss persistent | ||
# notifications. These calls would fail without this fixture since the persistent_notification | ||
# integration is never loaded during a test. | ||
@pytest.fixture(name="skip_notifications", autouse=True) | ||
def skip_notifications_fixture(): | ||
"""Skip notification calls.""" | ||
with patch("homeassistant.components.persistent_notification.async_create"), patch( | ||
"homeassistant.components.persistent_notification.async_dismiss" | ||
): | ||
yield | ||
|
||
|
||
# This fixture, when used, will result in calls to async_get_data to return None. To have the call | ||
# return a value, we would add the `return_value=<VALUE_TO_RETURN>` parameter to the patch call. | ||
@pytest.fixture(name="bypass_get_data") | ||
def bypass_get_data_fixture(): | ||
"""Skip calls to get data from API.""" | ||
with patch("custom_components.leslies_pool.LesliesPoolApiClient.async_get_data"): | ||
yield | ||
|
||
|
||
# In this fixture, we are forcing calls to async_get_data to raise an Exception. This is useful | ||
# for exception handling. | ||
@pytest.fixture(name="error_on_get_data") | ||
def error_get_data_fixture(): | ||
"""Simulate error when retrieving data from API.""" | ||
@pytest.fixture | ||
def mock_setup_entry() -> Generator[AsyncMock, None, None]: | ||
"""Override async_setup_entry.""" | ||
with patch( | ||
"custom_components.leslies_pool.LesliesPoolApiClient.async_get_data", | ||
side_effect=Exception, | ||
): | ||
yield | ||
"homeassistant.components.leslies_pool.async_setup_entry", return_value=True | ||
) as mock_setup_entry: | ||
yield mock_setup_entry |
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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
"""Constants for leslies_pool tests.""" | ||
from custom_components.leslies_pool.const import ( | ||
CONF_PASSWORD, | ||
) | ||
from custom_components.leslies_pool.const import ( | ||
CONF_USERNAME, | ||
) | ||
from custom_components.leslies_pool.const import CONF_PASSWORD | ||
from custom_components.leslies_pool.const import CONF_USERNAME | ||
|
||
MOCK_CONFIG = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"} |
Oops, something went wrong.