本文整理汇总了Python中models.Customer.get_points_for方法的典型用法代码示例。如果您正苦于以下问题:Python Customer.get_points_for方法的具体用法?Python Customer.get_points_for怎么用?Python Customer.get_points_for使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Customer
的用法示例。
在下文中一共展示了Customer.get_points_for方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_point_deletion
# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import get_points_for [as 别名]
def test_point_deletion(self):
result = Customer.get_points_for('sudhirurl')
start_count = len(result)
first_point = result[0]
Point.delete_point(first_point['key'], self.sudhir_gmail)
new_result = Customer.get_points_for('sudhirurl')
self.assertEqual(len(new_result), start_count - 1)
self.assertFalse(self.find(new_result, first_point))
示例2: test_user_creation_and_editing
# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import get_points_for [as 别名]
def test_user_creation_and_editing(self):
test_user = users.User('[email protected]')
new = Customer.create(url='test', user=test_user)
self.assertTrue(new)
self.assertEqual(Customer.get_points_for('test').__len__(), 0)
self.assertTrue(Point.create_point(new, dict(lat=63.345, lon= -4.23)))
self.assertEqual(Customer.get_points_for('test').__len__(), 1)
self.assertRaises(Exception, Customer.create, url='test', user=users.User('[email protected]'))
self.assertRaises(Exception, Customer.create, url='TeSt', user=users.User('[email protected]'))
self.assertRaises(Exception, Customer.create, url='new_test', user=test_user)
renew = Customer.create(url='newtest', user=test_user)
self.assertTrue(renew)
self.assertEqual(Customer.get_points_for('newtest').__len__(), 1)
self.assertTrue(Point.create_point(renew, dict(lat=43.345, lon= -3.23)))
self.assertEqual(Customer.get_points_for('newtest').__len__(), 2)
示例3: test_point_editing
# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import get_points_for [as 别名]
def test_point_editing(self):
result = Customer.get_points_for('sudhirurl')
start_count = len(result)
new_point_dict = dict(lat=7.0, lon=7.0, title="seven")
new_point_key = Point.create_point(self.sudhir, new_point_dict).key().__str__()
result = Customer.get_points_for('sudhirurl')
self.assertEqual(len(result), start_count + 1)
self.assertTrue(self.find(result, new_point_dict))
new_point_dict = dict(lon=7.0, lat=8.0, title='seveneight')
Point.edit(new_point_key, new_point_dict, self.sudhir_gmail)
new_results = Customer.get_points_for('sudhirurl')
self.assertEqual(len(new_results), start_count + 1)
self.assertTrue(self.find(new_results, new_point_dict))
self.assertRaises(db.BadValueError, Point.edit, new_point_key, dict(lon=2345, lat=3, title='invalid values'), self.sudhir_gmail)
示例4: test_setting_points_for_user
# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import get_points_for [as 别名]
def test_setting_points_for_user(self):
mom = models.Customer(user=users.User('[email protected]'), url='momurl')
mom.put()
confirmation = Point.create_point(mom, dict(lat=34.678, lon= -44.3456))
self.assertTrue(confirmation)
result = Customer.get_points_for('momurl')
self.assertEqual(len(result), 1)
self.assertEqual(result.count(dict(lat=34.678, lon= -44.3456, title='Untitled', key=str(confirmation.key()))), 1)
示例5: test_getting_points_for_user
# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import get_points_for [as 别名]
def test_getting_points_for_user(self):
valid_result = Customer.get_points_for('sudhirurl')
self.assertEqual(len(valid_result), 2)
valid_result = Customer.get_points_for('suDhirurl')
self.assertEqual(len(valid_result), 2)
valid_result = Customer.get_points_for('sudhirURl')
self.assertEqual(len(valid_result), 2)
non_existent_url = Customer.get_points_for('somerubbish')
self.assertEqual(non_existent_url, None)
new_guy = models.Customer(user=users.User('[email protected]'), url='someguyurl')
new_guy.put()
empty_result = Customer.get_points_for('someguyurl')
self.assertEqual(empty_result, [])
empty_result = Customer.get_points_for('SomEguyurl')
self.assertEqual(empty_result, [])
示例6: get_points_for
# 需要导入模块: from models import Customer [as 别名]
# 或者: from models.Customer import get_points_for [as 别名]
def get_points_for(url):
return Customer.get_points_for(url)