mirror of
https://github.com/torlando-tech/columba.git
synced 2025-12-23 22:20:18 +00:00
Add comprehensive test coverage for TCP RNode functionality, focusing on uncovered branches and edge cases: - RNodeWizardViewModel (13 tests): TCP validation, RSSI polling, pairing retry, CDM association, manual device name validation - DeviceDiscoveryStep (18 tests): TCP mode UI, manual entry forms, device card interactions, edit mode - ReviewConfigStep (8 tests): New test file for config review UI, region cards, duty cycle warnings, advanced settings - reticulum_wrapper.py (12 tests): Error handling, callback registration, BLE path cleanup, state transitions - Stub modules (5 tests): New test file for usb4a, jnius, usbserial4a import validation - InterfaceRepository (5 tests): UDP/AutoInterface/AndroidBLE validation edge cases All 61 tests pass successfully. Coverage improvements target TCP validation error paths, UI state management, Python error handling, and configuration validation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
73 lines
2.2 KiB
Python
73 lines
2.2 KiB
Python
"""Tests for stub modules (usb4a, jnius, usbserial4a).
|
|
|
|
These stub modules exist to satisfy import checks in RNode interfaces when
|
|
running on Chaquopy (Android Python). They allow TCP RNode connections to work
|
|
even though the actual USB/Bluetooth functionality uses native Kotlin code.
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
import unittest
|
|
|
|
# Add parent directory to path
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
class TestStubModules(unittest.TestCase):
|
|
"""Test stub module functionality"""
|
|
|
|
def test_usb4a_get_usb_device_returns_none(self):
|
|
"""Test that usb4a.usb.get_usb_device returns None"""
|
|
from usb4a import usb
|
|
|
|
result = usb.get_usb_device("any_device")
|
|
|
|
# Should return None since USB is not available in Chaquopy
|
|
self.assertIsNone(result)
|
|
|
|
def test_usb4a_usb_device_class_exists(self):
|
|
"""Test that usb4a.USBDevice class is importable"""
|
|
from usb4a import USBDevice
|
|
|
|
# Should be importable
|
|
self.assertIsNotNone(USBDevice)
|
|
|
|
# Should be a class
|
|
self.assertTrue(isinstance(USBDevice, type))
|
|
|
|
def test_jnius_autoclass_raises_not_implemented(self):
|
|
"""Test that jnius.autoclass raises NotImplementedError when called"""
|
|
from jnius import autoclass
|
|
|
|
# Should raise NotImplementedError when actually called
|
|
with self.assertRaises(NotImplementedError) as context:
|
|
autoclass("SomeClass")
|
|
|
|
# Verify error message is informative
|
|
self.assertIn("jnius.autoclass", str(context.exception))
|
|
self.assertIn("not available", str(context.exception))
|
|
|
|
def test_usbserial4a_serial4a_class_exists(self):
|
|
"""Test that usbserial4a.serial4a class is importable"""
|
|
from usbserial4a import serial4a
|
|
|
|
# Should be importable
|
|
self.assertIsNotNone(serial4a)
|
|
|
|
# Should be a class
|
|
self.assertTrue(isinstance(serial4a, type))
|
|
|
|
def test_usbserial4a_import_succeeds(self):
|
|
"""Test that usbserial4a module can be imported"""
|
|
import usbserial4a
|
|
|
|
# Should import successfully
|
|
self.assertIsNotNone(usbserial4a)
|
|
|
|
# Should have serial4a attribute
|
|
self.assertTrue(hasattr(usbserial4a, 'serial4a'))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|