Skip to content

Commit

Permalink
Merge pull request #12 from rado0x54/develop
Browse files Browse the repository at this point in the history
Release 0.0.5
  • Loading branch information
rado0x54 authored Nov 23, 2020
2 parents 6c84d94 + fdb9d41 commit 5fc2b7d
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ python:

jobs:
include:
- if: branch IN (master, develop)
python: 3.9
- if: branch IN (master, develop)
python: 3.8
- if: branch IN (master, develop)
Expand Down
2 changes: 1 addition & 1 deletion carson_living/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# Carson API endpoints
# Beware URLs end in '/', otherwise it returns a
# HTTP/1.1 301 Moved Permanently to the correct version.
C_API_VERSION = 'v1.4.1'
C_API_VERSION = 'v1.4.3'
C_API_URI = 'https://api.carson.live/api/' + C_API_VERSION

C_AUTH_ENDPOINT = '/auth/login/'
Expand Down
2 changes: 0 additions & 2 deletions scripts/carsoncli.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ def main():
with open('image_{}_3d_with_url.jpeg'.format(
cam.entity_id), 'wb') as file:
file.write(response.content)
# do only 1 cam.
break

try:
for cam in building.cameras:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Python Carson Living setup script."""
from setuptools import setup

_VERSION = '0.0.4'
_VERSION = '0.0.5'


def readme():
Expand Down Expand Up @@ -42,6 +42,7 @@ def readme():
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Home Automation',
'Topic :: Software Development :: Libraries :: Python Modules'
],
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/carson.live/carson_me.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"pmcName": "Landlord Inc.",
"serviceRequestsEnabled": true,
"comelitData": {
"hostAddress": "100.12.113.28",
"hostAddress": "127.0.0.1",
"port": 64100
},
"visitorInvitesLeft": 4,
Expand Down Expand Up @@ -151,7 +151,7 @@
"id": 2437,
"type": "phone_number",
"primary": true,
"contactInfo": "+14158890432",
"contactInfo": "+10000000000",
"verified": true,
"confirmationInfo": null
}
Expand Down
12 changes: 6 additions & 6 deletions tests/fixtures/carson.live/carson_me_update.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"pmcName": "Landlord Inc._update",
"serviceRequestsEnabled": true,
"comelitData": {
"hostAddress": "100.12.113.28_update",
"hostAddress": "127.0.0.1",
"port": 64100
},
"visitorInvitesLeft": 4,
Expand Down Expand Up @@ -150,7 +150,7 @@
"possibleToReceiveCalls": true,
"country": "United States_update",
"state": "New York_update",
"timezone": "America/New_York_update",
"timezone": "America/New_York",
"roles": [],
"units": [
{
Expand All @@ -176,8 +176,8 @@
"paymentsEnabled": false,
"visitors": [],
"area": {
"lat": 41.7866273,
"lon": -71.9755359,
"lat": 42.7866273,
"lon": -72.9755359,
"radius": 200
},
"visitorInviteEnabled": true,
Expand All @@ -186,7 +186,7 @@
"pmcName": "Landlord Inc._new",
"serviceRequestsEnabled": true,
"comelitData": {
"hostAddress": "100.12.113.28_new",
"hostAddress": "127.0.0.1",
"port": 64100
},
"visitorInvitesLeft": 4,
Expand Down Expand Up @@ -218,7 +218,7 @@
"id": 2437,
"type": "phone_number_update",
"primary": true,
"contactInfo": "+14158890432_update",
"contactInfo": "+10000000000_update",
"verified": true,
"confirmationInfo": null
}
Expand Down
18 changes: 9 additions & 9 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_auth_valid_token_init(self):
@requests_mock.Mocker()
def test_update_token_success(self, mock):
"""Test token update"""
mock.post('https://api.carson.live/api/v1.4.1/auth/login/',
mock.post('https://api.carson.live/api/v1.4.3/auth/login/',
text=load_fixture('carson.live', 'carson_login.json'))

mock_token_update_cb = Mock()
Expand All @@ -89,7 +89,7 @@ def test_update_token_success(self, mock):
@requests_mock.Mocker()
def test_update_token_fail(self, mock):
"""Test authentication failure in token update"""
mock.post('https://api.carson.live/api/v1.4.1/auth/login/',
mock.post('https://api.carson.live/api/v1.4.3/auth/login/',
text=load_fixture('carson.live', 'carson_auth_failure.json'),
status_code=401)

Expand All @@ -110,9 +110,9 @@ def test_expired_token_is_invalid(self):
@requests_mock.Mocker()
def test_successful_query_without_initial_token(self, mock):
"""Test automatic authentication on query without initial token"""
mock.post('https://api.carson.live/api/v1.4.1/auth/login/',
mock.post('https://api.carson.live/api/v1.4.3/auth/login/',
text=load_fixture('carson.live', 'carson_login.json'))
query_url = 'https://api.carson.live/api/v1.4.1/me/'
query_url = 'https://api.carson.live/api/v1.4.3/me/'
mock.get(query_url,
text=load_fixture('carson.live', 'carson_me.json'))

Expand All @@ -129,7 +129,7 @@ def test_successful_query_without_initial_token(self, mock):
@requests_mock.Mocker()
def test_successful_query_with_initial_token(self, mock):
"""Test query with initial valid token"""
query_url = 'https://api.carson.live/api/v1.4.1/me/'
query_url = 'https://api.carson.live/api/v1.4.3/me/'
mock.get(query_url,
text=load_fixture('carson.live', 'carson_me.json'))

Expand All @@ -148,9 +148,9 @@ def test_successful_query_with_initial_token(self, mock):
@requests_mock.Mocker()
def test_recursive_retry(self, mock):
""""Test recursive query retry on Authentication Failure"""
mock.post('https://api.carson.live/api/v1.4.1/auth/login/',
mock.post('https://api.carson.live/api/v1.4.3/auth/login/',
text=load_fixture('carson.live', 'carson_login.json'))
query_url = 'https://api.carson.live/api/v1.4.1/me/'
query_url = 'https://api.carson.live/api/v1.4.3/me/'
mock.get(query_url,
text=load_fixture('carson.live', 'carson_auth_failure.json'),
status_code=401)
Expand All @@ -169,7 +169,7 @@ def test_recursive_retry(self, mock):
@requests_mock.Mocker()
def test_raise_communication_error_on_empty(self, mock):
"""Test failure on empty response"""
query_url = 'https://api.carson.live/api/v1.4.1/me/'
query_url = 'https://api.carson.live/api/v1.4.3/me/'
mock.get(query_url,
status_code=500)

Expand All @@ -185,7 +185,7 @@ def test_raise_communication_error_on_empty(self, mock):
@requests_mock.Mocker()
def test_raise_communication_error_wrong_json(self, mock):
"""Test failure on response with missing keys"""
query_url = 'https://api.carson.live/api/v1.4.1/me/'
query_url = 'https://api.carson.live/api/v1.4.3/me/'
mock.get(query_url,
text=load_fixture('carson.live', 'carson_missing_keys.json'))

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py35, py36, py37, py38, lint
envlist = py27, py35, py36, py37, py38, py39, lint
skip_missing_interpreters = True

[testenv]
Expand Down

0 comments on commit 5fc2b7d

Please sign in to comment.