Пример #1
0
class TestHardwareManager(unittest.TestCase):
    """
    Test to make sure that the HardwareManager is working
    """

    def setUp(self):
        self.hw = HardwareManager('virtual')

    def tearDown(self):
        pass

    def test_unknown_module(self):
        with pytest.raises(UnknownModuleTypeError):
            self.hw._create_proxy('UnknownTileBusModule', 8)

    def test_uuid_to_slug(self):
        """Test UUID to DeviceSlug."""

        with pytest.raises(ArgumentError):
            uuid_to_slug('a')

        with pytest.raises(ArgumentError):
            uuid_to_slug(-1)

        with pytest.raises(ArgumentError):
            uuid_to_slug(0xffffffff)

        assert uuid_to_slug(1) == 'd--0000-0000-0000-0001'
        assert uuid_to_slug(0x9c400) == 'd--0000-0000-0009-c400'
        assert uuid_to_slug(0x0fffffff) == 'd--0000-0000-0fff-ffff'
Пример #2
0
class TestHardwareManager(unittest.TestCase):
    """
    Test to make sure that the HardwareManager is working
    """

    def setUp(self):
        self.hw = HardwareManager('none')

    def tearDown(self):
        pass

    def test_unknown_module(self):
        with pytest.raises(UnknownModuleTypeError):
            self.hw._create_proxy('UnknownTileBusModule', 8)