本文整理汇总了Python中mhvdb2.models.Entity.active_member方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.active_member方法的具体用法?Python Entity.active_member怎么用?Python Entity.active_member使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mhvdb2.models.Entity
的用法示例。
在下文中一共展示了Entity.active_member方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MembersTestCases
# 需要导入模块: from mhvdb2.models import Entity [as 别名]
# 或者: from mhvdb2.models.Entity import active_member [as 别名]
#.........这里部分代码省略.........
errors = members.validate(self.test_member.name,
self.test_member.email,
self.test_member.phone,
"2014-12-25",
self.agreement_date,
self.test_member.is_keyholder)
self.assertEqual(len(errors), 0)
errors = members.validate(self.test_member.name,
self.test_member.email,
self.test_member.phone,
"The 25th of December, Stardate 21020",
self.agreement_date,
self.test_member.is_keyholder)
self.assertEqual(len(errors), 1)
def test_validate_agreement_date(self):
errors = members.validate(self.test_member.name,
self.test_member.email,
self.test_member.phone,
self.joined_date,
"2014-12-25",
self.test_member.is_keyholder)
self.assertEqual(len(errors), 0)
errors = members.validate(self.test_member.name,
self.test_member.email,
self.test_member.phone,
"The 25th of December, Stardate 21020",
self.agreement_date,
self.test_member.is_keyholder)
self.assertEqual(len(errors), 1)
def test_active_member(self):
self.assertTrue(self.test_member.active_member(),
'member agreement is current')
new_agreement_date = date.today()-timedelta(days=500)
members.update(self.test_member.id,
self.test_member.name,
self.test_member.email,
self.test_member.phone,
self.test_member.joined_date,
new_agreement_date,
self.test_member.is_keyholder)
member = Entity.get(Entity.id == self.test_member.id)
self.assertFalse(member.active_member(), 'member agreement not current')
def test_create(self):
member_id = members.create(self.test_member.name,
self.test_member.email,
self.test_member.phone,
self.test_member.joined_date,
self.test_member.agreement_date,
self.test_member.is_keyholder)
member = Entity.get(Entity.id == member_id)
self.assertNotEqual(member.id, self.test_member.id)
self.assertEqual(member.name, self.test_member.name)
self.assertEqual(member.email, self.test_member.email)
self.assertEqual(member.phone, self.test_member.phone)
self.assertEqual(member.joined_date, self.test_member.joined_date)
self.assertEqual(member.agreement_date, self.test_member.agreement_date)
self.assertEqual(member.is_keyholder, self.test_member.is_keyholder)
member.delete_instance()