Skip to content

Commit

Permalink
add simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
jupe committed Aug 1, 2024
1 parent 31677bf commit a7b977f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/test_StfClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ class MockResp:
with self.assertRaises(DeviceNotFound):
self.client.find_and_allocate({})

def test_fail_fast(self):

class MockResp:
devices = [{'serial': 123, 'present': True, 'ready': True, 'using': False, 'owner': None, 'status': 1}]
self.DevicesApi.return_value.get_devices = MagicMock(return_value=MockResp())
with self.assertRaises(DeviceNotFound):
self.client.find_and_allocate({})

def test_list_devices(self):
available = {'serial': 123, 'present': True, 'ready': True, 'using': False, 'owner': None, 'status': 3}
self.client.get_devices = MagicMock(return_value=[available])
Expand Down

0 comments on commit a7b977f

Please sign in to comment.