本文整理汇总了Python中socorro.external.postgresql.crashes.Crashes.get_comments方法的典型用法代码示例。如果您正苦于以下问题:Python Crashes.get_comments方法的具体用法?Python Crashes.get_comments怎么用?Python Crashes.get_comments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类socorro.external.postgresql.crashes.Crashes
的用法示例。
在下文中一共展示了Crashes.get_comments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_comments
# 需要导入模块: from socorro.external.postgresql.crashes import Crashes [as 别名]
# 或者: from socorro.external.postgresql.crashes.Crashes import get_comments [as 别名]
def test_get_comments(self):
crashes = Crashes(config=self.config)
today = datetimeutil.date_to_string(self.now)
# Test 1: results
params = {
"signature": "js",
}
res_expected = {
"hits": [
{
"email": None,
"date_processed": today,
"uuid": "def",
"user_comments": "hello"
},
{
"email": None,
"date_processed": today,
"uuid": "hij",
"user_comments": "hah"
}
],
"total": 2
}
res = crashes.get_comments(**params)
self.assertEqual(res, res_expected)
# Test 2: no results
params = {
"signature": "blah",
}
res_expected = {
"hits": [],
"total": 0
}
res = crashes.get_comments(**params)
self.assertEqual(res, res_expected)
# Test 3: missing parameter
self.assertRaises(MissingArgumentError, crashes.get_comments)
示例2: test_get_comments
# 需要导入模块: from socorro.external.postgresql.crashes import Crashes [as 别名]
# 或者: from socorro.external.postgresql.crashes.Crashes import get_comments [as 别名]
def test_get_comments(self):
crashes = Crashes(config=self.config)
today = datetimeutil.date_to_string(self.now)
# Test 1: results
params = {
"signature": "js",
}
res_expected = {
"hits": [
{
"email": None,
"date_processed": today,
"uuid": "def",
"user_comments": "hello"
},
{
"email": None,
"date_processed": today,
"uuid": "hij",
"user_comments": "hah"
}
],
"total": 2
}
res = crashes.get_comments(**params)
eq_(res, res_expected)
# Test 2: no results
params = {
"signature": "blah",
}
res_expected = {
"hits": [],
"total": 0
}
res = crashes.get_comments(**params)
eq_(res, res_expected)
# Test 3: missing parameter
assert_raises(MissingArgumentError, crashes.get_comments)
# Test a valid rapid beta versions
params = {
"signature": "cool_sig",
"products": "Firefox",
"versions": "Firefox:14.0b",
}
res_expected = {
'hits': [
{
'email': None,
'date_processed': today,
'uuid': 'nop',
'user_comments': 'hi!'
}
],
'total': 1
}
res = crashes.get_comments(**params)
eq_(res, res_expected)
# Test an invalid rapid beta versions
params = {
"signature": "cool_sig",
"versions": "WaterWolf:2.0b",
}
res_expected = {
'hits': [
{
'email': None,
'date_processed': today,
'uuid': 'qrs',
'user_comments': 'meow'
}
],
'total': 1
}
res = crashes.get_comments(**params)
eq_(res, res_expected)
# use pagination
params = {
"signature": "cool_sig",
"result_number": 1,
"result_offset": 0,
}
params['result_number'] = 1
params['result_offset'] = 0
res = crashes.get_comments(**params)
eq_(len(res['hits']), 1)
eq_(res['total'], 2)
示例3: test_get_comments
# 需要导入模块: from socorro.external.postgresql.crashes import Crashes [as 别名]
# 或者: from socorro.external.postgresql.crashes.Crashes import get_comments [as 别名]
def test_get_comments(self):
crashes = Crashes(config=self.config)
today = datetimeutil.date_to_string(self.now)
# Test 1: results
params = {
"signature": "js",
}
res_expected = {
"hits": [
{
"email": None,
"date_processed": today,
"uuid": "def",
"user_comments": "hello"
},
{
"email": None,
"date_processed": today,
"uuid": "hij",
"user_comments": "hah"
}
],
"total": 2
}
res = crashes.get_comments(**params)
self.assertEqual(res, res_expected)
# Test 2: no results
params = {
"signature": "blah",
}
res_expected = {
"hits": [],
"total": 0
}
res = crashes.get_comments(**params)
self.assertEqual(res, res_expected)
# Test 3: missing parameter
self.assertRaises(MissingArgumentError, crashes.get_comments)
# Test a valid rapid beta versions
params = {
"signature": "cool_sig",
"products": "Firefox",
"versions": "Firefox:14.0b",
}
res_expected = {
'hits': [
{
'email': None,
'date_processed': today,
'uuid': 'nop',
'user_comments': 'hi!'
}
],
'total': 1
}
res = crashes.get_comments(**params)
self.assertEqual(res, res_expected)
# Test an invalid rapid beta versions
params = {
"signature": "cool_sig",
"versions": "WaterWolf:2.0b",
}
res = crashes.get_comments(**params)
self.assertTrue(res)