本文整理汇总了Python中models.Employee.in_company方法的典型用法代码示例。如果您正苦于以下问题:Python Employee.in_company方法的具体用法?Python Employee.in_company怎么用?Python Employee.in_company使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Employee
的用法示例。
在下文中一共展示了Employee.in_company方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestEmployee
# 需要导入模块: from models import Employee [as 别名]
# 或者: from models.Employee import in_company [as 别名]
class TestEmployee(TestCase):
def setUp(self):
self.region = Region(name="test_region")
self.region.save()
self.company = Company(code="1001", name="test_company", region=self.region)
self.company.save()
self.store = Store(code="10011001", name="test_store", company=self.company)
self.store.save()
self.emp_region = Employee(username="emp_region", organization=self.region)
self.emp_company = Employee(username="emp_company", organization=self.company)
self.emp_store = Employee(username="emp_store", organization=self.store)
def test_organizations(self):
organizations = self.emp_region.organizations()
self.assertEquals([self.region], organizations)
organizations = self.emp_company.organizations()
self.assertEquals([self.region, self.company], organizations)
organizations = self.emp_store.organizations()
self.assertEquals([self.region, self.company, self.store], organizations)
def test_in_xxx_org(self):
# employee in region
self.assertTrue(self.emp_region.in_region())
self.assertFalse(self.emp_region.in_company())
self.assertFalse(self.emp_region.in_store())
# employee in company
self.assertFalse(self.emp_company.in_region())
self.assertTrue(self.emp_company.in_company())
self.assertFalse(self.emp_company.in_store())
# employee in company
self.assertFalse(self.emp_store.in_region())
self.assertFalse(self.emp_store.in_company())
self.assertTrue(self.emp_store.in_store())
def test_org(self):
self.assertEqual(self.emp_region.org(), self.region)
self.assertEqual(self.emp_company.org(), self.company)
self.assertEqual(self.emp_store.org(), self.store)