Skip to content

Commit

Permalink
Merge pull request #77 from NabuCasa/dev
Browse files Browse the repository at this point in the history
Release 0.17
  • Loading branch information
pvizeli authored Aug 19, 2019
2 parents f482961 + 0c1229f commit 2be3bd2
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 17 deletions.
10 changes: 10 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.7

WORKDIR /workspace

# Install Python dependencies from requirements.txt if it exists
COPY requirements_tests.txt /workspace/
RUN pip3 install -r requirements_tests.txt

# Set the default shell to bash instead of sh
ENV SHELL /bin/bash
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Hass-NabuCasa Dev",
"context": "..",
"dockerFile": "Dockerfile",
"postCreateCommand": "pip3 install -e .",
"runArgs": [
"-e",
"GIT_EDTIOR='code --wait'"
],
"extensions": [
"ms-python.python",
"ms-azure-devops.azure-pipelines"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--target-version",
"py36"
],
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.shell.linux": "/bin/bash"
}
}
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:
versionSpec: '3.7'
- script: pip install black
displayName: 'Install black'
- script: black --check hass_nabucasa tests
- script: |
black --target-version py36 --check hass_nabucasa tests
displayName: 'Run Black'
Expand Down
14 changes: 7 additions & 7 deletions hass_nabucasa/acme.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ class AcmeHandler:
def __init__(self, cloud, domain: str, email: str) -> None:
"""Initialize local ACME Handler."""
self.cloud = cloud
self._acme_server = cloud.acme_directory_server
self._account_jwk = None
self._acme_client = None
self._x509 = None
self._acme_server: str = cloud.acme_directory_server
self._account_jwk: Optional[jose.JWKRSA] = None
self._acme_client: Optional[client.ClientV2] = None
self._x509: Optional[x509.Certificate] = None

self._domain = domain
self._email = email
self._domain: str = domain
self._email: str = email

@property
def path_account_key(self) -> Path:
Expand Down Expand Up @@ -352,7 +352,7 @@ async def issue_certificate(self) -> None:

# Update DNS
try:
async with async_timeout.timeout(15):
async with async_timeout.timeout(30):
resp = await cloud_api.async_remote_challenge_txt(
self.cloud, challenge.validation
)
Expand Down
2 changes: 1 addition & 1 deletion hass_nabucasa/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def _cognito(self, **kwargs):
user_pool_id=self.cloud.user_pool_id,
client_id=self.cloud.cognito_client_id,
user_pool_region=self.cloud.region,
**kwargs
**kwargs,
)
cognito.client = boto3.client(
"cognito-idp",
Expand Down
8 changes: 4 additions & 4 deletions hass_nabucasa/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ async def _create_context(self) -> ssl.SSLContext:

await self.cloud.run_executor(
context.load_cert_chain,
str(self._acme.path_fullchain),
str(self._acme.path_private_key),
self._acme.path_fullchain,
self._acme.path_private_key,
)

return context
Expand All @@ -121,7 +121,7 @@ async def load_backend(self) -> None:

# Load instance data from backend
try:
async with async_timeout.timeout(15):
async with async_timeout.timeout(30):
resp = await cloud_api.async_remote_register(self.cloud)
assert resp.status == 200
except (asyncio.TimeoutError, AssertionError):
Expand Down Expand Up @@ -228,7 +228,7 @@ async def _refresh_snitun_token(self) -> None:
# Generate session token
aes_key, aes_iv = generate_aes_keyset()
try:
async with async_timeout.timeout(15):
async with async_timeout.timeout(30):
resp = await cloud_api.async_remote_token(self.cloud, aes_key, aes_iv)
assert resp.status == 200
except (asyncio.TimeoutError, AssertionError):
Expand Down
3 changes: 2 additions & 1 deletion requirements_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ flake8==3.7.7
pylint==2.3.1
pytest==4.3.0
pytest-timeout==1.3.3
pytest-aiohttp==0.3.0
pytest-aiohttp==0.3.0
black==19.3b0
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

VERSION = "0.16"
VERSION = "0.17"

setup(
name="hass-nabucasa",
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def request(
params=None,
headers={},
exc=None,
cookies=None
cookies=None,
):
"""Mock a request."""
if json is not None:
Expand Down Expand Up @@ -117,7 +117,7 @@ async def match_request(
headers=None,
allow_redirects=None,
timeout=None,
json=None
json=None,
):
"""Match a request against pre-registered requests."""
data = data or json
Expand Down

0 comments on commit 2be3bd2

Please sign in to comment.