def post_id(self, user):
                another_user = UserFactory()

                post = PostFactory()
                LikeFactory(post_id=post.id, user_id=another_user.id)

                return post.id
Exemple #2
0
class LikeFactory(factory.alchemy.SQLAlchemyModelFactory):
    user_id = factory.Sequence(lambda n: UserFactory().id)
    post_id = factory.Sequence(lambda n: PostFactory().id)

    # user_id = factory.SubFactory(FakeUserFactory)
    # post_id = factory.SubFactory(FakePostFactory)

    class Meta:
        model = Likes
        sqlalchemy_session = db.session
 def post_id(self, user):
     post = PostFactory()
     LikeFactory(post_id=post.id, user_id=user.id)
     return post.id
 def form(self, title):
     post = PostFactory.build(title=title)
     return post
 def target_post(self, user):
     post = PostFactory()
     LikeFactory(post_id=post.id, user_id=user.id)
     print(Likes.query.all())
     return post
        def board(self):
            board = BoardFactory()
            board.posts = PostFactory.create_batch(20)
            self.session.commit()

            return board
Exemple #7
0
 def post(self, board):
     return PostFactory.create(board=board.id)
Exemple #8
0
 def posts(self):
     PostFactory.create_batch(
         11, created_at=factory.Faker('date_between').generate())
Exemple #9
0
 def target_post(self):
     post = PostFactory()
     return post
Exemple #10
0
 def post(self, board, logged_in_user):
     return PostFactory.create(board=board.id, author=logged_in_user.id)
 def form(self):
     post = PostFactory.build()
     return post
 def post_id(self):
     post = PostFactory()
     return post.id
 def post_id(self):
     post = PostFactory()
     post.likes = LikeFactory.create_batch(15)
     return post.id
Exemple #14
0
 def post(self, another_user):
     return PostFactory.create(likes=[str(another_user.id)])
Exemple #15
0
 def post(self, logged_in_user):
     return PostFactory.create(likes=[str(logged_in_user.id)])
Exemple #16
0
 def posts(self, users):
     for _ in range(0, 10):
         number_of_likes = random.randint(0, 10)
         random_users = random.sample(users, k=number_of_likes)
         PostFactory.create(
             likes=[str(user.id) for user in random_users])
Exemple #17
0
 def recent_post(self):
     return PostFactory.create(
         created_at=arrow.utcnow().format('YYYY-MM-DD HH:mm:ss'))
 def post_id(self):
     post = PostFactory.build()
     return post.id
 def form(self, content):
     post = PostFactory.build(content=content)
     return post
Exemple #20
0
 def post(self):
     return PostFactory.create()
 def target_post(self, user):
     post = PostFactory(user_id=user.id, user=user)
     self.session.commit()
     return post
Exemple #22
0
 def post(self, board, logged_in_user):
     return PostFactory.create(board=board.id, likes=[str(logged_in_user.id)])
 def post_id(self, user):
     post = PostFactory(user=user, user_id=user.id)
     self.session.commit()
     return post.id
Exemple #24
0
 def post(self, board, logged_in_member):
     return PostFactory.create(board=board.id, writer=logged_in_member.id)
 def post_id(self):
     post = PostFactory()
     self.session.commit()
     return post.id