Skip to content

Commit 7a168ec

Browse files
committed
wip: migrate hub
1 parent 2f87916 commit 7a168ec

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
pylint `ls -r|grep .py$|xargs` --disable=import-error,E1101 || pylint-exit --error-fail --warn-fail --convention-fail $?
2727
pylint openpod `ls -r|grep .py$|xargs` --disable=import-error,E1101 || pylint-exit --error-fail --warn-fail --convention-fail $?
2828
29-
pylint tests `ls -r|grep .py$|xargs` --disable=import-error,E1101 || pylint-exit --error-fail --warn-fail --convention-fail $?
29+
pylint tests `ls -r|grep .py$|xargs` --disable=import-error,E1101,R0801 || pylint-exit --error-fail --warn-fail --convention-fail $?

openpod/modules/rec_mqtt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def on_message(client, userdata, message):
5858

5959
if 0 < int(message.payload) <= 256:
6060
mqtt_actions[int(message.payload)]()
61-
return
61+
return True
6262

6363
except ValueError as err:
6464
mqtt_log.info("Not a single number command. Error: %s", err)
@@ -77,7 +77,7 @@ def on_message(client, userdata, message):
7777

7878
if look_up_responce == 1:
7979
rec_xbee.transmit(node_mac.group(1), f"{node_command.group(1)}")
80-
return
80+
return True
8181

8282
except IndexError as err:
8383
mqtt_log.error("Unable to extract MAC with the following error: %s", err)

tests/modules/test_lookup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_count_matching_mac(self):
8989

9090
mock_open.assert_called()
9191

92-
class TestLookUpAccessRequest(unittest.TestCase):
92+
class TestLookUpAccessRequest(unittest.TestCase): # pylint: disable=R0904
9393
'''Access Request Tests'''
9494

9595
def setUp(self):

tests/modules/test_mqtt.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
from modules import rec_mqtt
88

99

10-
class DummyMessage:
10+
class DummyMessage: # pylint: disable=R0903
11+
'''Creating a mock response'''
12+
1113
def __init__(self, command):
1214
self.payload=command
1315

@@ -21,7 +23,9 @@ def test_function_calls(self):
2123
Checks that the function calls are correct.
2224
'''
2325
with patch('modules.rec_mqtt.rec_api.link_hub') as mock_link:
24-
rec_mqtt.on_message('test_client', None, DummyMessage('170'))
26+
self.assertTrue(
27+
rec_mqtt.on_message('test_client', None, DummyMessage('170'))
28+
)
2529
mock_link.assert_called()
2630

2731
with patch('modules.rec_mqtt.rec_api.pull_data_dump') as mock_pull:

0 commit comments

Comments
 (0)