def test_custom_manager(self): manager = Mock() get_device(host=self.test_host, port=self.test_port, manager=manager) self.assertTrue(manager.get_class.called) self.assertEqual(dict(host=self.test_host, port=self.test_port), manager.get_class.call_args[1])
def test_custom_device_cls(self): obj = object() NoopDevice = Mock(return_value=obj) device = get_device(host=self.test_host, port=self.test_port, device_cls=NoopDevice) self.assertTrue(obj is device)
def test_get_device(self): device = get_device(host=self.test_host, port=self.test_port) self.assertTrue(isinstance(device, DefaultDevice))