Skip to content

Commit

Permalink
test refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
attdona committed Oct 1, 2017
1 parent 3ea5d5d commit e606723
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions burba/tests/test_cc3200_bocia.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
"""bocia layer tests
"""
import os
import socket
import pynais.iottest as iot
import pynais as ns
import socket
import tc

def get_ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]


events = (
EVENTS = (
('IP acquired', 'IP_ACQUIRED'),
("([\d]+) Tests ([\d]+) Failures ([\d]+) Ignored", 'TEST_RESULT'),
('expected connection failed', 'CONN_FAILED_OK'),
Expand All @@ -21,10 +17,12 @@ def get_ip_address():


def handle_event(event, uart):
"""react to board events
"""

if(event.name == 'CONN_FAILED_OK'):
# configure the board with the bocia settings
host_ip = get_ip_address()
host_ip = ns.my_ip_address()
cfg = ns.msg.Config(network=tc.network, board=tc.board, host=host_ip)
uart.write(ns.marshall(cfg))

Expand Down Expand Up @@ -59,7 +57,9 @@ def handle_event(event, uart):


def test_init_board():
"""compile, flash register events map and start event loop
"""
tc.check_test_requirements()

iot.run('bocia', tc.fw_deploy_ctx, events=events, handler=handle_event, timeout=20)
iot.run('bocia', tc.fw_deploy_ctx, events=EVENTS, handler=handle_event, timeout=20)

0 comments on commit e606723

Please sign in to comment.