本文整理汇总了Python中socorro.external.postgresql.crashes.Crashes.get_paireduuid方法的典型用法代码示例。如果您正苦于以下问题:Python Crashes.get_paireduuid方法的具体用法?Python Crashes.get_paireduuid怎么用?Python Crashes.get_paireduuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.external.postgresql.crashes.Crashes
的用法示例。
在下文中一共展示了Crashes.get_paireduuid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_paireduuid
# 需要导入模块: from socorro.external.postgresql.crashes import Crashes [as 别名]
# 或者: from socorro.external.postgresql.crashes.Crashes import get_paireduuid [as 别名]
def test_get_paireduuid(self):
crashes = Crashes(config=self.config)
yesterday = self.now - datetime.timedelta(days=1)
uuid = "%%s-%s" % self.now.strftime("%y%m%d")
yesterday_uuid = "%%s-%s" % yesterday.strftime("%y%m%d")
#......................................................................
# Test 1: a uuid and a hangid
params = {
"uuid": uuid % "a1",
"hangid": "ab1"
}
res = crashes.get_paireduuid(**params)
res_expected = {
"hits": [
{
"uuid": uuid % "a2"
}
],
"total": 1
}
self.assertEqual(res, res_expected)
#......................................................................
# Test 2: a uuid only
params = {
"uuid": uuid % "a1"
}
res = crashes.get_paireduuid(**params)
res_expected = {
"hits": [
{
"uuid": uuid % "a2"
},
{
"uuid": uuid % "a3"
}
],
"total": 2
}
self.assertEqual(res, res_expected)
#......................................................................
# Test 3: a query with no result
params = {
"uuid": uuid % "b1"
}
res = crashes.get_paireduuid(**params)
res_expected = {
"hits": [],
"total": 0
}
self.assertEqual(res, res_expected)
#......................................................................
# Test 4: one result that was yesterday
params = {
"uuid": uuid % "c1"
}
res = crashes.get_paireduuid(**params)
res_expected = {
"hits": [
{
"uuid": yesterday_uuid % "c2"
}
],
"total": 1
}
self.assertEqual(res, res_expected)
#......................................................................
# Test 5: missing argument
params = {
"hangid": "c1"
}
self.assertRaises(MissingArgumentError,
crashes.get_paireduuid,
**params)