def create_new_user(self, body): user = User(first_name=body['first_name'], last_name=body['last_name'], email=body['email'], username=body['email']) user.set_password(body['password']) user.save()
def create_user(self): user = User(first_name='first_name', last_name='last_name', email='email', username='******') user.set_password('password') user.save() return user
def _create_user(self, email=None): email = email if email else self.EMAIL user = User(first_name='first_name', last_name='last_name', email=email, username=email) user.set_password(self.PASSWORD) user.save() return user
def create_users_and_posts(self): user1 = User(first_name='first_name', last_name='last_name', email='email1', username='******') user1.set_password('password') user1.save() user2 = User(first_name='first_name', last_name='last_name', email='email2', username='******') user2.set_password('password') user2.save() post_us1_ac = Post.objects.create(name='name1', text='text', author=user1, status=Post.ACTIVE) post_us1_pd = Post.objects.create(name='name2', text='text', author=user1, status=Post.PENDING) post_us1_dl = Post.objects.create(name='name3', text='text', author=user1, status=Post.DELETED) post_us2_ac = Post.objects.create(name='name4', text='text', author=user2, status=Post.ACTIVE) post_us2_pd = Post.objects.create(name='name5', text='text', author=user2, status=Post.PENDING) post_us2_dl = Post.objects.create(name='name6', text='text', author=user2, status=Post.DELETED) return (user1, user2, post_us1_ac, post_us1_pd, post_us1_dl, post_us2_ac, post_us2_pd, post_us2_dl)