Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shawaj committed Dec 4, 2021
1 parent 449eda7 commit ac03578
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
11 changes: 6 additions & 5 deletions tests/gatewayconfig/processors/test_diagnostics_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ class TestDiagnosticsProcessor(TestCase):
def mocked_requests_get(*args, **kwargs):
DIAGNOSTICS_JSON_MOCK = {
"AN": "acrobatic-neon-caribou", "APPNAME": "Indoor", "BA": "dev-marvin", "BCH": 976046, "BN": "snowy-river",
"BSP": 98.337, "BT": True, "BUTTON": 26, "CELLULAR": False, "E0": "00:BD:27:78:06:EF", "ECC": True,
"BSP": 98.337, "BT": True, "BUTTON": 26, "CELLULAR": False, "E0": "00:BD:27:78:06:EF", "ECC": True,
"ECCOB": True, "FR": "915", "FRIENDLY": "Nebra Indoor Hotspot Gen 1", "FW": "2021.08.16.1",
"ID": "851af059f032f4708fc6b77d07e9bc15", "LOR": False, "LTE": False, "MAC": "eth0", "MC": "yes", "MD": "yes",
"MH": "959816", "MN": "symmetric", "MR": True, "MS": False, "OK": "11cdcEkzjvbGRwpNkihsqoM4yCsrw66jCznJkVuJDcyTf5xKJP",
"PF": True, "PK": "11cecEkzjvbGdwpNkihsqoM4yCsrw66jCznJkVuJDcyTf5xKJP", "RE": "US915", "RESET": 38,
"ID": "851af059f032f4708fc6b77d07e9bc15", "LOR": False, "LTE": False, "MAC": "eth0", "MC": "yes",
"MD": "yes", "MH": "959816", "MN": "symmetric", "MR": True, "MS": False,
"OK": "11cdcEkzjvbGRwpNkihsqoM4yCsrw66jCznJkVuJDcyTf5xKJP", "PF": True,
"PK": "11cecEkzjvbGdwpNkihsqoM4yCsrw66jCznJkVuJDcyTf5xKJP", "RE": "US915", "RESET": 38,
"RPI": "0000000057a920e3", "SPIBUS": "spidev1.2", "STATUS": 25, "TYPE": "Full", "VA": "NEBHNT-IN1",
"W0": "C8:FE:30:FF:F1:72", "last_updated": "21:38 UTC 21 Aug 2021"
}
}

class MockResponse:
def __init__(self, json_data, status_code):
Expand Down
17 changes: 13 additions & 4 deletions tests/gatewayconfig/test_gatewayconfig_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@
Device.pin_factory = MockFactory()

ETHO_FILE_MOCK = 'A1:B2:C3:DD:E5:F6'
DIAGNOSTICS_RESPONSE_MOCK = '{"AN":"big-apple-animal","APPNAME":"Outdoor","BA":"HELIUM-OUTDOOR-915","BCH":0005594,"BN":"warm-night","BSP":0.0,"BT":true,"BUTTON":24,"CELLULAR":true,"E0":"00:00:00:EF:7F:F7","ECC":true,"ECCOB":true,"FR":"915","FRIENDLY":"Nebra Outdoor Hotspot Gen 1","FW":"2021.10.07.1","ID":"111111111111439dbbdb408ca51a93f6","LOR":true,"LTE":false,"MAC":"eth0","MC":true,"MD":true,"MH":1,"MN":"none","MR":false,"MS":false,"OK":"11111111111111zFs11TjTSb2hPBZMwq527XdQv2L7ibh4Ma4f4D","PF":true,"PK":"11111111111111zFs11TjTSb2hPBZMwq527XdQv2L7ibh4Ma4f4D","RE":"UN123","RESET":38,"RPI":"00000000000092f3","SPIBUS":"spidev1.2","STATUS":25,"TYPE":"Full","VA":"NEBHNT-OUT1","W0":"00:00:6B:20:00:42","last_updated":"17:40 UTC 15 Oct 2021"}'
DIAGNOSTICS_RESPONSE_MOCK = (
'{"AN":"big-apple-animal","APPNAME":"Outdoor","BA":"HELIUM-OUTDOOR-915","BCH":0005594,"BN":"warm-night",'
'"BSP":0.0,"BT":true,"BUTTON":24,"CELLULAR":true,"E0":"00:00:00:EF:7F:F7","ECC":true,"ECCOB":true,"FR":"915",'
'"FRIENDLY":"Nebra Outdoor Hotspot Gen 1","FW":"2021.10.07.1","ID":"111111111111439dbbdb408ca51a93f6",'
'"LOR":true,"LTE":false,"MAC":"eth0","MC":true,"MD":true,"MH":1,"MN":"none","MR":false,"MS":false,'
'"OK":"11111111111111zFs11TjTSb2hPBZMwq527XdQv2L7ibh4Ma4f4D","PF":true,'
'"PK":"11111111111111zFs11TjTSb2hPBZMwq527XdQv2L7ibh4Ma4f4D","RE":"UN123","RESET":38,"RPI":"00000000000092f3",'
'"SPIBUS":"spidev1.2","STATUS":25,"TYPE":"Full","VA":"NEBHNT-OUT1","W0":"00:00:6B:20:00:42",'
'"last_updated":"17:40 UTC 15 Oct 2021"}')


class TestGatewayconfigSha(TestCase):
Expand All @@ -22,9 +30,10 @@ class TestGatewayconfigSha(TestCase):
@patch('requests.get', response=DIAGNOSTICS_RESPONSE_MOCK)
def test_gpio_pins(self, mock_dbus_interface, mock_findadapter, mock_getbus, mock_file, mock_diagnostics):
os.environ['BALENA_DEVICE_TYPE'] = 'TEST'
app = GatewayconfigApp('https://[email protected]/1111111', 'BALENA_APP_NAME',
'BALENA_DEVICE_UUID', 'NEBHNT-IN1', 'ETH0_MOCK_USED', 'WLAN0_MAC_ADDRESS_FILEPATH', 'DIAGNOSTICS_JSON_URL',
'ETHERNET_IS_ONLINE_FILEPATH', 'FIRMWARE_VERSION')
app = GatewayconfigApp('https://[email protected]/1111111',
'BALENA_APP_NAME', 'BALENA_DEVICE_UUID', 'NEBHNT-IN1', 'ETH0_MOCK_USED',
'WLAN0_MAC_ADDRESS_FILEPATH', 'DIAGNOSTICS_JSON_URL', 'ETHERNET_IS_ONLINE_FILEPATH',
'FIRMWARE_VERSION')

self.assertEqual(app.variant, 'NEBHNT-IN1')
self.assertEqual(app.get_button_pin(), 26)
Expand Down

0 comments on commit ac03578

Please sign in to comment.