本文整理匯總了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)