def setup(self): self.username = '******' self.password = '******' self.email = '*****@*****.**' User.create_user(username=self.username, password=self.password, email=self.email)
def setup(self): self.username = '******' self.password = '******' self.email = '*****@*****.**' User.create_user( username=self.username, password=self.password, email=self.email )
def setup(self): self.users = [] for x in range(3): self.users.append( User.create_user(username='******' + str(x), password='******' + str(x), email='user' + str(x) + '@a.com'))
def setup(self): self.users = [] for x in range(3): self.users.append( User.create_user( username='******' + str(x), password='******' + str(x), email='user' + str(x) + '@a.com' ) )
def setup(self): c = Category.objects.create( name=u'python', description=u'描述', _slug=u'python-slug' ) Post.objects.create( title=u'标题test', content=u'内容test', category=c ) # login user self.username = '******' self.password = '******' self.email = '*****@*****.**' self.user = User.create_user( username=self.username, password=self.password, email=self.email )
def login(cls): user = User.objects.filter(email='*****@*****.**').first() if user is None: user = User.create_user('foo', '*****@*****.**', 'foobar') else: user.set_password('foobar') user.save() form = { 'email': '*****@*****.**', 'password': '******', } rv = client.post(url_for('home.login'), data=form, follow_redirects=True) assert current_user.is_authenticated() assert url_for('security.logout') in rv.data
def login(cls): user = User.objects.filter(email='*****@*****.**').first() if user is None: user = User.create_user('foo', '*****@*****.**', 'foobar') else: user.set_password('foobar') user.save() form = { 'email': '*****@*****.**', 'password': '******', } rv = client.post( url_for('home.login'), data=form, follow_redirects=True ) assert current_user.is_authenticated() assert url_for('security.logout') in rv.data
def save(self): return User.create_user( username=self.username.data, email=self.email.data, password=self.password.data )