From a7b977fd95f2e78ea07ad37bb877e8fdd558e052 Mon Sep 17 00:00:00 2001 From: Jussi Vatjus-Anttila Date: Thu, 1 Aug 2024 14:29:06 +0300 Subject: [PATCH] add simple test --- test/test_StfClient.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_StfClient.py b/test/test_StfClient.py index 4f25c34..ba5a7e1 100644 --- a/test/test_StfClient.py +++ b/test/test_StfClient.py @@ -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])