-
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.
- Loading branch information
Showing
11 changed files
with
156 additions
and
20 deletions.
There are no files selected for viewing
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,13 @@ | ||
from typing import List | ||
from LibreView.models import Connection | ||
from LibreView.utils import API | ||
|
||
|
||
class LibreView: | ||
client: API | ||
|
||
def __init__(self, username: str, password: str): | ||
self.client = API(username, password) | ||
|
||
def get_connections(self) -> List[Connection]: | ||
return self.client.get_connections() |
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 @@ | ||
from LibreView.utils import * | ||
from LibreView.LibreView import LibreView |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from LibreView.models.Connection import Connection | ||
from LibreView.models.Device import Device | ||
from LibreView.models.GlucoseMeasurement import GlucoseMeasurement | ||
from LibreView.models.Practice import Practice | ||
from LibreView.models.Sensor import Sensor | ||
from LibreView.models.User import User |
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 +1 @@ | ||
from .API import API | ||
from LibreView.utils.API import API |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from datetime import datetime | ||
import os | ||
from uuid import UUID | ||
from LibreView import LibreView | ||
from LibreView.models import Connection, GlucoseMeasurement, Sensor | ||
|
||
USERNAME: str = os.environ["libre_username"] | ||
PASSWORD: str = os.environ["libre_password"] | ||
|
||
|
||
def test_connections(): | ||
libre = LibreView(USERNAME, PASSWORD) | ||
cons = libre.get_connections() | ||
assert len(cons) > 0 | ||
con = cons[0] | ||
assert isinstance(con, Connection) | ||
assert isinstance(con.id, UUID) | ||
assert isinstance(con.patient_id, UUID) | ||
assert isinstance(con.country, str) | ||
assert isinstance(con.status, int) | ||
assert isinstance(con.first_name, str) | ||
assert isinstance(con.last_name, str) | ||
assert isinstance(con.target_low, int) | ||
assert isinstance(con.target_high, int) | ||
assert isinstance(con.uom, int) | ||
|
||
assert isinstance(con.sensor, Sensor) | ||
assert isinstance(con.glucose_measurement, GlucoseMeasurement) | ||
|
||
sensor = con.sensor | ||
assert isinstance(sensor.device_id, str) | ||
assert isinstance(sensor.sn, str) | ||
assert isinstance(sensor.a, int) | ||
assert isinstance(sensor.w, int) | ||
assert isinstance(sensor.pt, int) | ||
assert isinstance(sensor.s, bool) | ||
assert isinstance(sensor.lj, bool) | ||
|
||
gm = con.glucose_measurement | ||
assert isinstance(gm.type, int) | ||
assert isinstance(gm.value_in_mg_per_dl, int) | ||
assert isinstance(gm.trend_arrow, int) | ||
assert isinstance(gm.measurement_color, int) | ||
assert isinstance(gm.glucose_units, int) | ||
assert isinstance(gm.value, float) | ||
assert isinstance(gm.is_high, bool) | ||
assert isinstance(gm.is_low, bool) | ||
assert isinstance(gm.factory_timestamp, datetime) | ||
assert isinstance(gm.timestamp, datetime) | ||
assert isinstance(gm.trend_message, str) or gm.trend_message is None |
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