Skip to content

Commit

Permalink
fix: use get_public_keys_rust correctly
Browse files Browse the repository at this point in the history
Response has 'key' not 'PK'
  • Loading branch information
marvinmarnold committed Nov 25, 2021
1 parent baeea6b commit 75ad4d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gatewayconfig/gatewayconfig_shared_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ def load_public_key(self):

try:
public_keys = get_public_keys_rust()
self.public_key = public_keys['PK']
self.public_key = public_keys['key']
except Exception:
LOGGER.exception("Unable to read public key.")
4 changes: 2 additions & 2 deletions tests/gatewayconfig/test_gatewayconfig_shared_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def test_to_s(self):
self.assertEqual(shared_state.to_s(),
'{"wifi_list_cache": [], "should_scan_wifi": false, "should_advertise_bluetooth": true, "is_advertising_bluetooth": false, "are_diagnostics_ok": false, "public_key": "Unavailable"}')

@patch('gatewayconfig.gatewayconfig_shared_state.get_public_keys_rust', return_value={'PK': 'foo'})
@patch('gatewayconfig.gatewayconfig_shared_state.get_public_keys_rust', return_value={'key': 'foo'})
def test_load_public_key(self, _):
shared_state = GatewayconfigSharedState()
shared_state.load_public_key()
self.assertEqual(shared_state.public_key, 'foo')

@patch('gatewayconfig.gatewayconfig_shared_state.get_public_keys_rust', return_value={'PK': 'foo'})
@patch('gatewayconfig.gatewayconfig_shared_state.get_public_keys_rust', return_value={'key': 'foo'})
def test_load_public_key_dont_override(self, _):
shared_state = GatewayconfigSharedState()
shared_state.public_key = 'already_set'
Expand Down

0 comments on commit 75ad4d0

Please sign in to comment.