本文整理汇总了Python中corehq.apps.sms.models.PhoneNumber._migration_get_fields方法的典型用法代码示例。如果您正苦于以下问题:Python PhoneNumber._migration_get_fields方法的具体用法?Python PhoneNumber._migration_get_fields怎么用?Python PhoneNumber._migration_get_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.sms.models.PhoneNumber
的用法示例。
在下文中一共展示了PhoneNumber._migration_get_fields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCouchSyncToSQL
# 需要导入模块: from corehq.apps.sms.models import PhoneNumber [as 别名]
# 或者: from corehq.apps.sms.models.PhoneNumber import _migration_get_fields [as 别名]
def testCouchSyncToSQL(self):
self.assertEqual(self.getCouchCount(), 0)
self.assertEqual(self.getSQLCount(), 0)
# Test Create
couch_obj = VerifiedNumber()
self.setRandomCouchObjectValues(couch_obj)
couch_obj.save()
sleep(1)
self.assertEqual(self.getCouchCount(), 1)
self.assertEqual(self.getSQLCount(), 1)
sql_obj = PhoneNumber.objects.get(couch_id=couch_obj._id)
self.checkFieldValues(couch_obj, sql_obj, PhoneNumber._migration_get_fields())
self.assertTrue(VerifiedNumber.get_db().get_rev(couch_obj._id).startswith('1-'))
# Test Update
self.setRandomCouchObjectValues(couch_obj)
couch_obj.save()
sleep(1)
self.assertEqual(self.getCouchCount(), 1)
self.assertEqual(self.getSQLCount(), 1)
sql_obj = PhoneNumber.objects.get(couch_id=couch_obj._id)
self.checkFieldValues(couch_obj, sql_obj, PhoneNumber._migration_get_fields())
self.assertTrue(VerifiedNumber.get_db().get_rev(couch_obj._id).startswith('2-'))
# Test Delete
couch_id = couch_obj._id
couch_obj.delete()
with self.assertRaises(ResourceNotFound):
VerifiedNumber.get(couch_id)
self.assertEqual(self.getCouchCount(), 0)
self.assertEqual(self.getSQLCount(), 0)
示例2: testCouchRetire
# 需要导入模块: from corehq.apps.sms.models import PhoneNumber [as 别名]
# 或者: from corehq.apps.sms.models.PhoneNumber import _migration_get_fields [as 别名]
def testCouchRetire(self):
self.assertEqual(self.getCouchCount(), 0)
self.assertEqual(self.getSQLCount(), 0)
# Create
couch_obj = VerifiedNumber()
self.setRandomCouchObjectValues(couch_obj)
couch_obj.save()
sleep(1)
self.assertEqual(self.getCouchCount(), 1)
self.assertEqual(self.getSQLCount(), 1)
sql_obj = PhoneNumber.objects.get(couch_id=couch_obj._id)
self.checkFieldValues(couch_obj, sql_obj, PhoneNumber._migration_get_fields())
self.assertTrue(VerifiedNumber.get_db().get_rev(couch_obj._id).startswith('1-'))
# Test retire()
couch_obj.retire()
self.assertTrue(VerifiedNumber.get(couch_obj._id).doc_type.endswith('-Deleted'))
self.assertEqual(self.getCouchCount(), 0)
self.assertEqual(self.getSQLCount(), 0)