Ejemplo n.º 1
0
    def create(self, sess, comment):
        author = comment.author.name
        q = sess.query(Investor).filter(Investor.name == author).exists()

        if not sess.query(q).scalar():
            sess.add(Investor(name=author))
            comment.reply_wrap(message.modify_create(comment.author, 1000))
Ejemplo n.º 2
0
 def test_autocreate(self):
     replies = self.command('!saldo')
     self.assertEqual(len(replies), 2)
     self.assertEqual(
         replies[0].body,
         message.modify_create('testuser', config.STARTING_BALANCE))
     self.assertEqual(
         replies[1].body,
         message.modify_balance(config.STARTING_BALANCE,
                                config.STARTING_BALANCE))
Ejemplo n.º 3
0
    def create(self, sess, comment):
        author = comment.author.name
        q = sess.query(Investor).filter(Investor.name == author).exists()

        # Let user know they already have an account
        if sess.query(q).scalar():
            comment.reply_wrap(message.create_exists_org)
            return

        # Create new investor account
        sess.add(Investor(name=author))
        comment.reply_wrap(message.modify_create(comment.author, 1000))
Ejemplo n.º 4
0
    def create(self, sess, comment):
        """
        This one is responsible for creating a new user
        """
        author = comment.author.name
        user_exists = sess.query(Investor).filter(Investor.name == author).exists()

        # Let user know they already have an account
        if sess.query(user_exists).scalar():
            return comment.reply_wrap(message.CREATE_EXISTS_ORG)

        # Create new investor account
        sess.add(Investor(name=author))
        # TODO: Make the initial balance a constant
        return comment.reply_wrap(message.modify_create(comment.author, config.STARTING_BALANCE))
Ejemplo n.º 5
0
def create(comment, author):

    database.investor_insert(author, starter)
    send_reply(comment, message.modify_create(author, starter))
Ejemplo n.º 6
0
 def test_create(self):
     replies = self.command('!create')
     self.assertEqual(len(replies), 1)
     self.assertEqual(replies[0].body,
                      message.modify_create('testuser', 1000))
Ejemplo n.º 7
0
def create(comment, author):
    users[author] = Investor(author, starter)
    send_not(comment, message.modify_create(author, users[author].get_balance()), True)