修改bug, 添加测试文件

pull/6/head
ibuler 2014-12-23 22:27:45 +08:00
parent a05e4147a3
commit c715c8ec02
2 changed files with 30 additions and 1 deletions

View File

@ -20,7 +20,7 @@ class Asset(models.Model):
password_common = models.CharField(max_length=160, blank=True, null=True) password_common = models.CharField(max_length=160, blank=True, null=True)
username_super = models.CharField(max_length=80, 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) 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) comment = models.CharField(max_length=100, blank=True, null=True)
def __unicode__(self): def __unicode__(self):

29
test_add_user.py Normal file
View 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()