Пример #1
0
 def setup(self):
     self.username = '******'
     self.password = '******'
     self.email = '*****@*****.**'
     User.create_user(username=self.username,
                      password=self.password,
                      email=self.email)
Пример #2
0
 def setup(self):
     self.username = '******'
     self.password = '******'
     self.email = '*****@*****.**'
     User.create_user(
         username=self.username, password=self.password,
         email=self.email
     )
Пример #3
0
 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'))
Пример #4
0
 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'
             )
         )
Пример #5
0
    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
        )
Пример #6
0
    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
Пример #7
0
    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
Пример #8
0
 def save(self):
     return User.create_user(
         username=self.username.data, email=self.email.data,
         password=self.password.data
     )