mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 15:11:27 +00:00
修改bug, 添加测试文件
This commit is contained in:
@@ -20,7 +20,7 @@ class Asset(models.Model):
|
||||
password_common = models.CharField(max_length=160, blank=True, null=True)
|
||||
username_super = models.CharField(max_length=80, blank=True, null=True)
|
||||
password_super = models.CharField(max_length=160, blank=True, null=True)
|
||||
date_added = models.CharField(max_length=80)
|
||||
date_added = models.IntegerField(max_length=80)
|
||||
comment = models.CharField(max_length=100, blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
|
29
test_add_user.py
Normal file
29
test_add_user.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#coding: utf-8
|
||||
import os
|
||||
import django
|
||||
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'jumpserver.settings'
|
||||
django.setup()
|
||||
from juser.models import User, Group
|
||||
from jasset.models import Asset, IDC
|
||||
from jpermission.models import Permission
|
||||
|
||||
|
||||
g = Group(name='wzp', comment='wzp project')
|
||||
g.save()
|
||||
|
||||
u = User(username='hadoop', password='hadoop', name='hadoop', email='ibuler@qq.com', group=g,
|
||||
ldap_pwd='hadoop', ssh_key_pwd='hadoop', date_joined=0)
|
||||
u.save()
|
||||
|
||||
i = IDC(name='lf')
|
||||
i.save()
|
||||
|
||||
a = Asset(ip='172.16.1.122', port=2001, idc=i, group=g, date_added=0)
|
||||
a.save()
|
||||
|
||||
p = Permission(user=u, asset=a)
|
||||
p.save()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user