Esempio n. 1
0
    def test_add_member(self):
        """Make sure we can add a new member."""
        row_count = db.create_member('*****@*****.**', 'FirstName',
                                     'LastName', 'pass')
        self.assertEqual(row_count, 1)

        test_member = db.find_member('*****@*****.**')
        self.assertIsNotNone(test_member)

        self.assertEqual(test_member['first_name'], 'FirstName')
        self.assertEqual(test_member['last_name'], 'LastName')
Esempio n. 2
0
    def test_update_member(self):
        """Add and then update a member."""
        row_count = db.create_member('*****@*****.**', 'FirstName',
                                     'LastName', 'pass')
        self.assertEqual(row_count, 1)

        row_count = db.update_member('*****@*****.**', 'NewFirstName',
                                     'LastName', 'newpass')
        self.assertEqual(row_count, 1)

        test_member = db.find_member('*****@*****.**')
        self.assertIsNotNone(test_member)

        self.assertEqual(test_member['first_name'], 'NewFirstName')
        self.assertEqual(test_member['last_name'], 'LastName')
 def create_test_member(suffix=''):
     marital = db.get_marital_status_by_name('Other')
     how = db.get_how_did_you_find_out_by_name('Other')
     return db.create_member({
         'first_name': 'New',
         'last_name': 'Member',
         'email': 'newmember' + suffix + '@example.com',
         'phone_number': '555-1212',
         'gender': 'F',
         'birthday': '2001-12-25',
         'baptism_status': True,
         'marital_status_id': marital['id'],
         'how_did_you_find_out_id': how['id'],
         'is_a_parent': True,
         'join_date': '2018-03-24'
     })
Esempio n. 4
0
    def test_add_member(self):
        """Make sure we can add a new user"""
        row_count = db.create_member("Ryley", "Hoekert", "*****@*****.**",
                                     "7192009832", "Female", "Never", 1, 0,
                                     "9/12/16")
        self.assertEqual(row_count, 1)
        member_id = db.recent_member()['id']
        test_hg = db.find_member(member_id)
        self.assertIsNotNone(test_hg)

        self.assertEqual(test_hg['first_name'], 'Ryley')
        self.assertEqual(test_hg['last_name'], 'Hoekert')
        self.assertEqual(test_hg['email'], '*****@*****.**')
        self.assertEqual(test_hg['phone_number'], '7192009832')
        self.assertEqual(test_hg['gender'], 'Female')
        self.assertEqual(test_hg['birthday'], 'Never')
        self.assertEqual(test_hg['baptism_status'], 1)
        self.assertEqual(test_hg['join_date'], '9/12/16')
Esempio n. 5
0
    def test_edit_member(self):
        """Make sure we can edit a homegroup"""
        row_count = db.create_member("Seth", "Gerald", "*****@*****.**",
                                     "922", "Male", "Christmas", 0, 0,
                                     "2/3/09")
        member_id = db.recent_member()['id']
        row_count = db.edit_member(member_id, 'First', 'Last',
                                   '*****@*****.**', "2", "Male", "Easter",
                                   1, 1, "2/3/09")
        test_hg = db.find_member(member_id)
        self.assertIsNotNone(test_hg)

        self.assertEqual(test_hg['first_name'], 'First')
        self.assertEqual(test_hg['last_name'], 'Last')
        self.assertEqual(test_hg['email'], '*****@*****.**')
        self.assertEqual(test_hg['phone_number'], '2')
        self.assertEqual(test_hg['gender'], 'Male')
        self.assertEqual(test_hg['birthday'], 'Easter')
        self.assertEqual(test_hg['baptism_status'], 1)
        self.assertEqual(test_hg['join_date'], '2/3/09')
def create_member():
    member = CreateMemberForm()

    if request.method == "POST" and member.validate():
        first_name = member.first_name.data
        last_name = member.last_name.data
        email = member.email.data
        phone_number = member.phone_number.data
        gender = member.gender.data
        birthday = request.form['Birthday']
        baptism_status = member.baptism_status.data
        marital_status = member.marital_status.data
        join_date = request.form['JoinDate']
        rowcount = db.create_member(first_name, last_name, email, phone_number, gender, birthday, baptism_status,
                                    marital_status, join_date)

        if rowcount == 1:
            flash("Member {} Created!".format(member.first_name.data))
            return redirect(url_for('all_members'))

    return render_template('create_member.html', form=member)
Esempio n. 7
0
def create_new_member_for_homegroup(homegroup_id):
    member = CreateMemberForm()
    if request.method == "POST" and member.validate():
        first_name = member.first_name.data
        last_name = member.last_name.data
        email = member.email.data
        phone_number = member.phone_number.data
        gender = member.gender.data
        birthday = request.form['Birthday']
        baptism_status = member.baptism_status.data
        marital_status = member.marital_status.data
        join_date = request.form['JoinDate']
        rowcount = db.create_member(first_name, last_name, email, phone_number, gender, birthday, baptism_status,
                                    marital_status, join_date)
        if rowcount == 1:
            row = db.recent_member()
            member_id = row['id']
            db.add_member_to_homegroup(homegroup_id, member_id)
            flash("Member {} Created!".format(member.first_name.data, member.last_name.data))
            return redirect(url_for('get_homegroup_members', homegroup_id=homegroup_id))

    return render_template('create_member.html', form=member, homegroup_id=homegroup_id)