Ejemplo n.º 1
0
 def test_template_not_op(self):
     post = Submission("post")
     comment = Comment("1/id", "commenter",
                       "!template https://i.imgur.com/asdas.jps", post)
     self.worker(comment)
     self.assertEqual(len(comment.replies), 1)
     self.assertEqual(comment.replies[0].body, message.TEMPLATE_NOT_OP)
Ejemplo n.º 2
0
 def test_template(self):
     post = Submission("post")
     comment = Comment("1/id", post.author.name,
                       "!template https://i.imgur.com/asdas.jps", post)
     self.worker(comment)
     self.assertEqual(len(comment.replies), 1)
     self.assertEqual(comment.replies[0].body, message.TEMPLATE_SUCCESS)
Ejemplo n.º 3
0
 def create_investment(self, amount, start_upvotes, end_upvotes, iid='0'):
     investor = Investor(name='investor' + iid)
     submission = Submission('sid' + iid)
     comment = Comment('cid' + iid, investor.name, 'dummy', submission)
     self.reddit.add_submission(submission)
     investment = Investment(
         post=comment.submission.id,
         upvotes=start_upvotes,
         comment=comment.id,
         name=comment.author.name,
         amount=amount,
         response="0",
         done=False,
     )
     investment.time = int(time.time()) - config.INVESTMENT_DURATION - 1
     submission.ups = end_upvotes
     sess = self.Session()
     sess.add(investor)
     sess.add(investment)
     sess.commit()
     return investor, investment
Ejemplo n.º 4
0
 def command(self,
             command,
             username='******',
             post='testpost',
             lcomment=None,
             lpost=None):
     submission = Submission(post)
     if lpost:
         lpost(submission)
     comment = Comment(post + '/id', username, command, submission)
     if lcomment:
         lcomment(comment)
     self.worker(comment)
     return comment.replies
Ejemplo n.º 5
0
 def command(self,
             command,
             username="******",
             post="testpost",
             lcomment=None,
             lpost=None):
     submission = Submission(post)
     self.submissions.append(submission)
     if lpost:
         lpost(submission)
     comment = Comment(post + "/id", username, command, submission)
     submission.replies.append(comment)
     self.comments.append(comment)
     if lcomment:
         lcomment(comment)
     self.worker(comment)
     return comment.replies
Ejemplo n.º 6
0
 def create_investment(self, amount, iid="0"):
     investor = Investor(name="investor" + iid)
     submission = Submission("sid" + iid)
     comment = Comment("cid" + iid, investor.name, "dummy", submission)
     self.reddit.add_submission(submission)
     investment = Investment(
         post=comment.submission.id,
         upvotes=1,
         comment=comment.id,
         name=comment.author.name,
         amount=amount,
         response="0",
         done=False,
     )
     buyable = Buyable(post=submission.id,
                       name=submission.author.name,
                       response="brid" + iid)
     buyable.time = int(time.time()) - config.INVESTMENT_DURATION - 1
     sess = self.session
     sess.add(buyable)
     sess.add(investor)
     sess.add(investment)
     sess.commit()
     return investor, buyable, submission
Ejemplo n.º 7
0
 def command(self, command, username='******', post='testpost'):
     comment = Comment(post + '/id', username, command, Submission(post))
     self.worker(comment)
     return comment.replies
Ejemplo n.º 8
0
 def test_template_not_op(self):
     post = Submission('post')
     comment = Comment('1/id', 'commenter', '!template https://i.imgur.com/asdas.jps', post)
     self.worker(comment)
     self.assertEqual(len(comment.replies), 1)
     self.assertEqual(comment.replies[0].body, message.TEMPLATE_NOT_OP)