コード例 #1
0
 def test_get_missing_arguments(self):
     """on .get() the adapter_hex and the vendor_hex is mandatory"""
     api = GraphicsDevices(config=self.config)
     with pytest.raises(MissingArgumentError):
         api.get()
     with pytest.raises(MissingArgumentError):
         api.get(adapter_hex='something')
     with pytest.raises(MissingArgumentError):
         api.get(vendor_hex='something')
     with pytest.raises(MissingArgumentError):
         # adapter_hex is empty!
         api.get(vendor_hex='something', adapter_hex='')
     with pytest.raises(MissingArgumentError):
         # vender_hex is empty!
         api.get(vendor_hex='', adapter_hex='something')
コード例 #2
0
 def test_get_missing_arguments(self):
     """on .get() the adapter_hex and the vendor_hex is mandatory"""
     api = GraphicsDevices(config=self.config)
     with pytest.raises(MissingArgumentError):
         api.get()
     with pytest.raises(MissingArgumentError):
         api.get(adapter_hex='something')
     with pytest.raises(MissingArgumentError):
         api.get(vendor_hex='something')
     with pytest.raises(MissingArgumentError):
         # adapter_hex is empty!
         api.get(vendor_hex='something', adapter_hex='')
     with pytest.raises(MissingArgumentError):
         # vender_hex is empty!
         api.get(vendor_hex='', adapter_hex='something')
コード例 #3
0
    def test_get(self):
        """returning rows by matching vendor_hex and adapter_hex"""
        api = GraphicsDevices(config=self.config)

        params = {
            'vendor_hex': '0x1002',
            'adapter_hex': '0x0166',
        }
        res = api.get(**params)
        res_expected = {
            'hits': [],
            'total': 0
        }
        eq_(res, res_expected)

        # insert something similar
        self._insert(
            '0x1002', '0x0166',
            vendor_name='Logitech Inc.',
            adapter_name='Unknown Webcam Pro 9000'
        )
        self._insert(
            '0x1002', '0xc064',
            vendor_name='Logitech Inc.',
            adapter_name='k251d DELL 6-Button mouse'
        )
        self._insert(
            '0x1222', '0x0166',
            vendor_name='Chicony Electronics Co.',
            adapter_name='Unknown Webcam Pro 9000'
        )

        # now we should get something
        res = api.get(**params)
        res_expected = {
            'hits': [{
                'vendor_hex': '0x1002',
                'adapter_hex': '0x0166',
                'vendor_name': 'Logitech Inc.',
                'adapter_name': 'Unknown Webcam Pro 9000'
            }],
            'total': 1
        }
        eq_(res, res_expected)
コード例 #4
0
    def test_get(self):
        """returning rows by matching vendor_hex and adapter_hex"""
        api = GraphicsDevices(config=self.config)

        params = {
            'vendor_hex': '0x1002',
            'adapter_hex': '0x0166',
        }
        res = api.get(**params)
        res_expected = {
            'hits': [],
            'total': 0
        }
        eq_(res, res_expected)

        # insert something similar
        self._insert(
            '0x1002', '0x0166',
            vendor_name='Logitech Inc.',
            adapter_name='Unknown Webcam Pro 9000'
        )
        self._insert(
            '0x1002', '0xc064',
            vendor_name='Logitech Inc.',
            adapter_name='k251d DELL 6-Button mouse'
        )
        self._insert(
            '0x1222', '0x0166',
            vendor_name='Chicony Electronics Co.',
            adapter_name='Unknown Webcam Pro 9000'
        )

        # now we should get something
        res = api.get(**params)
        res_expected = {
            'hits': [{
                'vendor_hex': '0x1002',
                'adapter_hex': '0x0166',
                'vendor_name': 'Logitech Inc.',
                'adapter_name': 'Unknown Webcam Pro 9000'
            }],
            'total': 1
        }
        eq_(res, res_expected)