Esempio n. 1
0
    def test_get_signup_count(self):
        with routes.app.test_request_context():
            database.add_registered_user(["Linus", "Kortesalmi", "*****@*****.**",
                                          "Sweden", "Linkoping", "g_plus"])
            expected_answer = 1

            self.assertEquals(database.get_signup_count(), expected_answer)
Esempio n. 2
0
def new_signup():
    info = [request.form['first_name'], request.form['last_name'], request.form['email'],
            request.form['country'], request.form['city'], request.form['reference']]

    try:
        # Add the message, throws sqlite3.IntegrityError
        database.add_registered_user(info)

        # Get the number of people signed up
        signups_count = database.get_signup_count()

        # Tweet that we have a new recruit!
        #social.tweet(info)

        # Visualize for the user that everything went O.K.
        return render_template('register_completed.html', signups=signups_count)

    except sqlite3.IntegrityError:
        # Show a message describing the error for the user
        flash('Email already signed up')
        return signup(info)