本文整理汇总了Python中crashstats.crashstats.models.GraphicsDevices.implementation方法的典型用法代码示例。如果您正苦于以下问题:Python GraphicsDevices.implementation方法的具体用法?Python GraphicsDevices.implementation怎么用?Python GraphicsDevices.implementation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类crashstats.crashstats.models.GraphicsDevices
的用法示例。
在下文中一共展示了GraphicsDevices.implementation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_graphics_devices_csv_upload_pci_ids
# 需要导入模块: from crashstats.crashstats.models import GraphicsDevices [as 别名]
# 或者: from crashstats.crashstats.models.GraphicsDevices import implementation [as 别名]
def test_graphics_devices_csv_upload_pci_ids(self):
self._login()
url = reverse('siteadmin:graphics_devices')
def mocked_post(**payload):
data = payload['data']
expected = {
'vendor_hex': '0x0010',
'adapter_hex': '0x8139',
'vendor_name': 'Allied Telesis, Inc',
'adapter_name': 'AT-2500TX V3 Ethernet'
}
assert data[0] == expected
assert len(data) == 6
return True
GraphicsDevices.implementation().post.side_effect = mocked_post
sample_file = os.path.join(
os.path.dirname(__file__),
'sample-pci.ids'
)
with open(sample_file) as fp:
response = self.client.post(url, {
'file': fp,
'database': 'pci.ids',
})
assert response.status_code == 302
assert url in response['location']
示例2: test_graphics_devices_edit
# 需要导入模块: from crashstats.crashstats.models import GraphicsDevices [as 别名]
# 或者: from crashstats.crashstats.models.GraphicsDevices import implementation [as 别名]
def test_graphics_devices_edit(self):
self._login()
url = reverse('siteadmin:graphics_devices')
def mocked_post(**payload):
data = payload['data']
expected = {
'vendor_hex': 'abc123',
'adapter_hex': 'xyz123',
'vendor_name': 'Logictech',
'adapter_name': 'Webcamera'
}
assert data[0] == expected
return True
GraphicsDevices.implementation().post.side_effect = mocked_post
data = {
'vendor_hex': 'abc123',
'adapter_hex': 'xyz123',
'vendor_name': 'Logictech',
'adapter_name': 'Webcamera'
}
response = self.client.post(url, data)
assert response.status_code == 302
assert url in response['location']
示例3: test_graphics_devices_csv_upload_pcidatabase_com
# 需要导入模块: from crashstats.crashstats.models import GraphicsDevices [as 别名]
# 或者: from crashstats.crashstats.models.GraphicsDevices import implementation [as 别名]
def test_graphics_devices_csv_upload_pcidatabase_com(self):
self._login()
url = reverse('siteadmin:graphics_devices')
def mocked_post(**payload):
data = payload['data']
expected = {
'vendor_hex': '0x0033',
'adapter_hex': '0x002f',
'vendor_name': 'Paradyne Corp.',
'adapter_name': '.43 ieee 1394 controller'
}
assert data[0] == expected
assert len(data) == 7
return True
GraphicsDevices.implementation().post.side_effect = mocked_post
sample_file = os.path.join(
os.path.dirname(__file__),
'sample-graphics.csv'
)
with open(sample_file) as fp:
response = self.client.post(url, {
'file': fp,
'database': 'pcidatabase.com',
})
assert response.status_code == 302
assert url in response['location']
示例4: test_graphics_devices_lookup
# 需要导入模块: from crashstats.crashstats.models import GraphicsDevices [as 别名]
# 或者: from crashstats.crashstats.models.GraphicsDevices import implementation [as 别名]
def test_graphics_devices_lookup(self):
self._login()
url = reverse('siteadmin:graphics_devices_lookup')
def mocked_get(**params):
if (
'adapter_hex' in params and
params['adapter_hex'] == 'xyz123' and
'vendor_hex' in params and
params['vendor_hex'] == 'abc123'
):
return {
"hits": [
{
"vendor_hex": "abc123",
"adapter_hex": "xyz123",
"vendor_name": "Logictech",
"adapter_name": "Webcamera"
}
],
"total": 1
}
raise NotImplementedError(url)
GraphicsDevices.implementation().get.side_effect = mocked_get
response = self.client.get(url)
assert response.status_code == 400
response = self.client.get(url, {
'vendor_hex': 'abc123',
'adapter_hex': 'xyz123',
})
assert response.status_code == 200
content = json.loads(response.content)
assert content['total'] == 1
expected = {
'vendor_hex': 'abc123',
'adapter_hex': 'xyz123',
'vendor_name': 'Logictech',
'adapter_name': 'Webcamera'
}
assert content['hits'][0] == expected