Exemple #1
0
 def setUp(self) -> None:
     ''' 加入admin并登录,初始化资产类型、部门、自定义属性
     添加旧资产 '''
     init_test(self)
     init_category()
     self.category = AssetCategory.root().name
     init_department()
     CustomAttr.objects.create(name='自定义')
     add_old_asset()
    def setUp(self) -> None:
        ''' 构造时添加一项用户 '''
        init_test(self)

        root = User.objects.get(username='******').department
        self.department_id = root.id
        user = User(username='******', department=root)
        user.set_password('zhanghx')
        user.save()
Exemple #3
0
 def setUp(self) -> None:
     ''' 创建一个admin名下的资产 '''
     init_test(self)
     init_category()
     Asset.objects.create(name='资产',
                          value=1,
                          category=AssetCategory.root(),
                          status='IDLE',
                          service_life=10,
                          owner=User.admin())
     self.category = AssetCategory.root().name
 def setUp(self) -> None:
     ''' 添加并登录admin '''
     init_test(self)
 def setUp(self) -> None:
     ''' add admin and login
     在顶层部门下添加一个子部门 '''
     init_test(self)
     Department.objects.create(name='子部门', parent=Department.root())