Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required,
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'

on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
name: Review Dependencies
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: 'Dependency Review'
uses: actions/dependency-review-action@8805179dc9a63c54224914839d370dd93bd37b2e # v4
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "infuse_iot"
version = "0.1.0"
version = "0.1.1"
authors = [{name = "Embeint Holdings Pty Ltd", email = "[email protected]"}]
description = "Infuse-IoT Platform python package"
classifiers = [
Expand Down
3 changes: 2 additions & 1 deletion src/infuse_iot/tdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

def unknown_tdf_factory(tdf_id: int, tdf_len: int) -> type[tdf_base.TdfReadingBase]:
class UnknownTDF(tdf_base.TdfReadingBase):
name = str(tdf_id)
NAME = str(tdf_id)
ID = tdf_id
_fields_ = [
("data", tdf_len * ctypes.c_uint8),
]
Expand Down
19 changes: 18 additions & 1 deletion tests/tdf/test_tdf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from infuse_iot.tdf import TDF
from infuse_iot.tdf import TDF, unknown_tdf_factory

# assert "TOXTEMPDIR" in os.environ, "you must run these tests using tox"

Expand Down Expand Up @@ -61,3 +61,20 @@ def test_buffers():
assert isinstance(tdf, TDF.Reading)
total_tdfs += 1
assert total_tdfs > 0


def test_unknown_tdf():
for i in range(1, 10):
unknown_id = 400 + i
unknown_len = 5 + i
unknown_class = unknown_tdf_factory(unknown_id, unknown_len)

assert hasattr(unknown_class, "ID")
assert hasattr(unknown_class, "NAME")
assert hasattr(unknown_class, "data")

unknown_inst = unknown_class.from_buffer_copy(unknown_len * b"\x00")

assert unknown_id == unknown_inst.ID
assert str(unknown_id) == unknown_inst.NAME
assert unknown_len == len(unknown_inst.data)
Loading