コード例 #1
0
            def post_id(self, user):
                another_user = UserFactory()

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

                return post.id
コード例 #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
コード例 #3
0
 def post_id(self, user):
     post = PostFactory()
     LikeFactory(post_id=post.id, user_id=user.id)
     return post.id
コード例 #4
0
 def form(self, title):
     post = PostFactory.build(title=title)
     return post
コード例 #5
0
 def target_post(self, user):
     post = PostFactory()
     LikeFactory(post_id=post.id, user_id=user.id)
     print(Likes.query.all())
     return post
コード例 #6
0
        def board(self):
            board = BoardFactory()
            board.posts = PostFactory.create_batch(20)
            self.session.commit()

            return board
コード例 #7
0
ファイル: test_post.py プロジェクト: aimmo-daniel/board
 def post(self, board):
     return PostFactory.create(board=board.id)
コード例 #8
0
 def posts(self):
     PostFactory.create_batch(
         11, created_at=factory.Faker('date_between').generate())
コード例 #9
0
 def target_post(self):
     post = PostFactory()
     return post
コード例 #10
0
ファイル: test_post.py プロジェクト: yenilee/board-project
 def post(self, board, logged_in_user):
     return PostFactory.create(board=board.id, author=logged_in_user.id)
コード例 #11
0
 def form(self):
     post = PostFactory.build()
     return post
コード例 #12
0
 def post_id(self):
     post = PostFactory()
     return post.id
コード例 #13
0
 def post_id(self):
     post = PostFactory()
     post.likes = LikeFactory.create_batch(15)
     return post.id
コード例 #14
0
 def post(self, another_user):
     return PostFactory.create(likes=[str(another_user.id)])
コード例 #15
0
 def post(self, logged_in_user):
     return PostFactory.create(likes=[str(logged_in_user.id)])
コード例 #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])
コード例 #17
0
 def recent_post(self):
     return PostFactory.create(
         created_at=arrow.utcnow().format('YYYY-MM-DD HH:mm:ss'))
コード例 #18
0
 def post_id(self):
     post = PostFactory.build()
     return post.id
コード例 #19
0
 def form(self, content):
     post = PostFactory.build(content=content)
     return post
コード例 #20
0
ファイル: test_post.py プロジェクト: yenilee/board-project
 def post(self):
     return PostFactory.create()
コード例 #21
0
 def target_post(self, user):
     post = PostFactory(user_id=user.id, user=user)
     self.session.commit()
     return post
コード例 #22
0
ファイル: test_post.py プロジェクト: yenilee/board-project
 def post(self, board, logged_in_user):
     return PostFactory.create(board=board.id, likes=[str(logged_in_user.id)])
コード例 #23
0
 def post_id(self, user):
     post = PostFactory(user=user, user_id=user.id)
     self.session.commit()
     return post.id
コード例 #24
0
ファイル: test_post.py プロジェクト: aimmo-daniel/board
 def post(self, board, logged_in_member):
     return PostFactory.create(board=board.id, writer=logged_in_member.id)
コード例 #25
0
 def post_id(self):
     post = PostFactory()
     self.session.commit()
     return post.id