示例#1
0
    def test_create_device(self):
        builder = DeviceBuilder(self.module)

        self.assertIsInstance(builder.create_device(), self.module.DummyDevice)
        self.assertIsInstance(builder.create_device("default"),
                              self.module.DummyDevice)
        self.assertIsInstance(builder.create_device("other"),
                              self.module.OtherDummyDevice)
示例#2
0
    def test_create_device(self):
        builder = DeviceBuilder(self.module)

        device = builder.create_device()
        self.assertIsInstance(device, self.module.DummyDevice)

        self.assertRaises(LewisException, builder.create_device, 'invalid_setup')
    def test_create_interface(self):
        builder = DeviceBuilder(self.module)

        device = builder.create_device()

        self.assertIsInstance(builder.create_interface(device=device), self.module.DummyAdapter)
        self.assertIsInstance(
            builder.create_interface('dummy', device=device), self.module.DummyAdapter)

        self.assertRaises(LewisException, builder.create_interface, 'invalid_protocol')
    def test_create_device(self):
        builder = DeviceBuilder(self.module)

        self.assertIsInstance(builder.create_device(), self.module.DummyDevice)
        self.assertIsInstance(builder.create_device('default'), self.module.DummyDevice)
        self.assertIsInstance(builder.create_device('other'), self.module.OtherDummyDevice)