It appears that the repository has undergone several changes and renamings:
This commit is contained in:
52
tests/test_tapo_direct.py
Normal file
52
tests/test_tapo_direct.py
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3.11
|
||||
"""
|
||||
Direkter Test der Tapo-Steckdosen-Funktionalität
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Pfad zum Backend hinzufügen
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
from utils.tapo_controller import tapo_controller
|
||||
from models import get_db_session, Printer
|
||||
|
||||
def test_tapo_functionality():
|
||||
"""Testet die Tapo-Funktionalität direkt"""
|
||||
|
||||
print('🔧 Teste Tapo-Controller...')
|
||||
|
||||
db_session = get_db_session()
|
||||
|
||||
try:
|
||||
printers = db_session.query(Printer).filter(
|
||||
Printer.plug_ip.isnot(None)
|
||||
).order_by(Printer.plug_ip).all()
|
||||
|
||||
print(f"📊 Gefunden: {len(printers)} Tapo-Steckdosen")
|
||||
|
||||
for printer in printers:
|
||||
print(f'\n📍 Teste {printer.plug_ip} ({printer.name})...')
|
||||
|
||||
try:
|
||||
reachable, status = tapo_controller.check_outlet_status(
|
||||
printer.plug_ip,
|
||||
printer_id=printer.id
|
||||
)
|
||||
|
||||
if reachable:
|
||||
print(f' ✅ Erreichbar - Status: {status}')
|
||||
else:
|
||||
print(f' ⚠️ Nicht erreichbar - Status: {status}')
|
||||
|
||||
except Exception as e:
|
||||
print(f' ❌ Fehler: {e}')
|
||||
|
||||
finally:
|
||||
db_session.close()
|
||||
|
||||
print('\n✅ Test abgeschlossen.')
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_tapo_functionality()
|
Reference in New Issue
Block a user