Skip to content

Commit bbce49e

Browse files
committed
Devices: The sshid property will return None if device is acceptable
1 parent ec022b0 commit bbce49e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

shellhub/models/device.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ def refresh(self) -> None:
136136
raise ShellHubApiError(e)
137137

138138
@property
139-
def sshid(self) -> str:
139+
def sshid(self) -> Optional[str]:
140+
if self.acceptable:
141+
return None
140142
return f"{self.namespace}.{self.name}@{self._api._endpoint}"
141143

142144
def __repr__(self) -> str:

tests/test_devices.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,7 @@ def test_accept_device(self, shellhub_device, requests_mock):
265265
class TestDeviceSSHID:
266266
def test_get_sshid(self, shellhub_device, shellhub):
267267
assert shellhub_device.sshid == f"{shellhub_device.namespace}.{shellhub_device.name}@{shellhub._endpoint}"
268+
269+
def test_acceptable_device_sshid(self, shellhub_device, shellhub):
270+
shellhub_device.acceptable = True
271+
assert shellhub_device.sshid is None

0 commit comments

Comments
 (0)