def test_not_equal(self): """This method verifies that when not equal __eq__ returns false""" testid = 'sxm1' user1 = accounts.find_users(cwruid=('=', testid))[0] user2 = accounts.find_users(cwruid=('=', 'exc'))[0] self.assertNotEqual(user1, user2)
def test_equal(self): """This method verifies that the __eq__ method works properly""" testid = "sxm1" user1 = accounts.find_users(cwruid=("=", testid))[0] user2 = accounts.find_users(cwruid=("=", testid))[0] self.assertEqual(user1, user2)
def test_equal(self): """This method verifies that the __eq__ method works properly""" testid = 'sxm1' user1 = accounts.find_users(cwruid=('=', testid))[0] user2 = accounts.find_users(cwruid=('=', testid))[0] self.assertEqual(user1, user2)
def test_not_equal(self): """This method verifies that when not equal __eq__ returns false""" testid = "sxm1" user1 = accounts.find_users(cwruid=("=", testid))[0] user2 = accounts.find_users(cwruid=("=", "exc"))[0] self.assertNotEqual(user1, user2)
def test_getattr_changes(self): """This method verifies that the __getattribute__ method will return the value that is pending""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] user.fname = 'Stanley' olduser = accounts.find_users(cwruid=('=', testid))[0] self.assertEqual(user.fname, 'Stanley') self.assertEqual(olduser.fname, 'Stan')
def test_getattr_changes(self): """This method verifies that the __getattribute__ method will return the value that is pending""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] user.fname = "Stanley" olduser = accounts.find_users(cwruid=("=", testid))[0] self.assertEqual(user.fname, "Stanley") self.assertEqual(olduser.fname, "Stan")
def test_delete(self): """This method verifies that the delete method on the User class updates the users in the datastore """ testid = 'sxm1' user1 = accounts.find_users(cwruid=('=', testid))[0] user1.delete() user2 = accounts.find_users(cwruid=('=', testid)) self.assertEqual(len(user2), 0)
def test_delete(self): """This method verifies that the delete method on the User class updates the users in the datastore """ testid = "sxm1" user1 = accounts.find_users(cwruid=("=", testid))[0] user1.delete() user2 = accounts.find_users(cwruid=("=", testid)) self.assertEqual(len(user2), 0)
def test_attributes(self): """This method verifies that the User class as the attributes specified in the design docs""" user = accounts.find_users(limit=1)[0] # check if there is an internal __User self.assertTrue(hasattr(user, "_User__UserModel"), "User class has no internal __UserModel attribute")
def list_users(): """ View for listing all users and listing users based on a search. If membership role or webmaster role is present then the user will also see edit links for the user """ can_edit = None query = UserRoleModel.all() query.filter('user ='******'webmaster': can_edit = True break users = find_users() return render_template('members/list.html', can_edit=can_edit, users=users)
def handle_edit_account_main_json(cwruid): """ This view allows the user and administrators to submit an ajax update request """ permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return jsonify({'result':'failure', 'msg':'Permission denied'}) main_form = forms.MainUpdateUserForm() if main_form.validate(): try: user = find_users(1, cwruid=('=', cwruid))[0] except IndexError: return jsonify({'result':'failure', 'name':'main', 'errors': {}}) user.fname = main_form.fname.data user.mname = main_form.mname.data user.lname = main_form.lname.data user.avatar = main_form.avatar.data user.save() return jsonify({'result':'success'}) else: return jsonify({'result':'failure', 'name':'main', 'errors': main_form.errors})
def list_users_by_family(family_name): """ This view displays a list of users for the family specified in family_name """ can_edit = None query = UserRoleModel.all() query.filter('user ='******'webmaster': can_edit = True break query = models.FamilyModel.all() query.filter('name =', urllib.unquote_plus(family_name).lower()) try: family = query.fetch(1)[0] except IndexError: return "no such family" return render_template('404.html'), 404 users = find_users(family=('=', family.key())) return render_template('members/list.html', can_edit=can_edit, family=family, users=users)
def handle_edit_contacts_phones_json(cwruid): """ This method handles the submission of the PhoneUpdateForm submitted from the display_edit_contacts view """ permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return jsonify({'result': 'failure', 'msg': 'Permission denied'}) try: user = find_users(1, cwruid=('=', cwruid))[0] except IndexError: return jsonify({'result': 'failure', 'name': 'main', 'errors': {}}) phones_form = forms.PhoneUpdateForm() if phones_form.validate(): query = models.PhoneModel.all() query.filter('user ='******'': name = None if phone_form.key.data == '': # create new phone phone = models.PhoneModel(user=user.key(), number=phone_form.phoneNumber.data, name=name) phone.put() else: # try and see what phone was updated index = None for i, phone in enumerate(phones): if str(phone.key()) == phone_form.key.data: phone.name = name phone.number = phone_form.phoneNumber.data phone.put() index = i break if index is not None: del phones[index] for phone in phones: phone.delete() else: # process errors errors = {} for i, phone_form in enumerate(phones_form.phones): for error in phone_form.errors: errors['phones-%i-%s' % (i, error)] = phone_form[str(error)].errors return jsonify({ 'result': 'failure', 'name': 'phones', 'errors': errors }) return jsonify({'result': 'success'})
def handle_edit_account_main_json(cwruid): """ This view allows the user and administrators to submit an ajax update request """ permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return jsonify({'result': 'failure', 'msg': 'Permission denied'}) main_form = forms.MainUpdateUserForm() if main_form.validate(): try: user = find_users(1, cwruid=('=', cwruid))[0] except IndexError: return jsonify({'result': 'failure', 'name': 'main', 'errors': {}}) user.fname = main_form.fname.data user.mname = main_form.mname.data user.lname = main_form.lname.data user.avatar = main_form.avatar.data user.save() return jsonify({'result': 'success'}) else: return jsonify({ 'result': 'failure', 'name': 'main', 'errors': main_form.errors })
def test_return_big_limit(self): """This method tests whether if limit is bigger than the total number of users that all users will be returned""" users = accounts.find_users(10) self.assertEqual(len(users), 4)
def test_get_id(self): """This method verifies that the get_id method returns the cwruid of the user""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] self.assertEqual(user.get_id(), user.cwruid)
def test_attributes(self): """This method verifies that the User class as the attributes specified in the design docs""" user = accounts.find_users(limit=1)[0] # check if there is an internal __User self.assertTrue(hasattr(user, '_User__UserModel'), 'User class has no internal __UserModel attribute')
def test_get_id(self): """This method verifies that the get_id method returns the cwruid of the user""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] self.assertEqual(user.get_id(), user.cwruid)
def display_edit_user_account(cwruid): """ This view allows the user and administrators to edit the account information of that user """ import urllib, urlparse permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return permission_denied(cwruid) # get the user object for this page try: user = find_users(1, cwruid=('=', cwruid))[0] except IndexError: return render_template('404.html'), 404 main_form = forms.MainUpdateUserForm(None) # initialize admin form if this user has # admin privileges admin_form = None if permissions[1]: admin_form = forms.AdminUpdateUserForm(None) # set the choices admin_form.family.choices = get_family_choices() admin_form.roles.choices = get_role_choices() # populate the main form main_form.fname.data = user.fname main_form.mname.data = user.mname main_form.lname.data = user.lname main_form.avatar.data = user.avatar # initialize the admin_form if needed if admin_form is not None: if user.family is not None: admin_form.family.data = user.family.name if user.big is not None: admin_form.big.data = user.big.cwruid query = UserRoleModel.all() query.filter('user ='******'members/edit_account.html', user=user, permissions=permissions, main_form=main_form, admin_form=admin_form)
def test_setattr(self): """This method verifies that the __setattr__ method will set a pending change on a valid attribute name""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] user.fname = 'Stanley'
def test_valid_password(self): """This method verifies that the check_password method works properly""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] self.assertTrue(user.valid_password("password")) self.assertFalse(user.valid_password("wrong"))
def test_setattr(self): """This method verifies that the __setattr__ method will set a pending change on a valid attribute name""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] user.fname = "Stanley"
def handle_edit_contacts_emails_json(cwruid): """ This method handles the submission of the EmailUpdateForm submitted from the display_edit_contacts view """ permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return jsonify({'result':'failure', 'msg':'Permission denied'}) emails_form = forms.EmailUpdateForm() if emails_form.validate(): try: user = find_users(1, cwruid=('=', cwruid))[0] except IndexError: return jsonify({'result':'failure', 'name':'main', 'errors': {}}) query = models.EmailModel.all() query.filter('user ='******'': # create new email name = email_form.emailName.data if name == '': name = None email = models.EmailModel(user=user.key(), email=email_form.emailAddress.data, name=name) email.put() else: # try and see what email was updated index = None for i, email in enumerate(emails): if str(email.key()) == email_form.key.data: email.name = email_form.emailName.data email.email = email_form.emailAddress.data email.put() index = i break # remove from the list so that # only emails with no associated # forms get deleted at the end if index is not None: del emails[index] for email in emails: email.delete() else: # process errors errors = {} for i, email_form in enumerate(emails_form.emails): for error in email_form.errors: errors['emails-%i-%s' % (i, error)] = email_form[str(error)].errors return jsonify({'result':'failure', 'name':'emails', 'errors': errors}) return jsonify({'result':'success'})
def test_valid_password(self): """This method verifies that the check_password method works properly""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] self.assertTrue(user.valid_password('password')) self.assertFalse(user.valid_password('wrong'))
def display_edit_user_account(cwruid): """ This view allows the user and administrators to edit the account information of that user """ import urllib, urlparse permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return permission_denied(cwruid) # get the user object for this page try: user = find_users(1,cwruid=('=', cwruid))[0] except IndexError: return render_template('404.html'), 404 main_form = forms.MainUpdateUserForm(None) # initialize admin form if this user has # admin privileges admin_form = None if permissions[1]: admin_form = forms.AdminUpdateUserForm(None) # set the choices admin_form.family.choices = get_family_choices() admin_form.roles.choices = get_role_choices() # populate the main form main_form.fname.data = user.fname main_form.mname.data = user.mname main_form.lname.data = user.lname main_form.avatar.data = user.avatar # initialize the admin_form if needed if admin_form is not None: if user.family is not None: admin_form.family.data = user.family.name if user.big is not None: admin_form.big.data = user.big.cwruid query = UserRoleModel.all() query.filter('user ='******'members/edit_account.html', user=user, permissions=permissions, main_form=main_form, admin_form=admin_form)
def test_return_cwruid_match(self): """This method tests whether the find_users method will return the user matching the cwruid specified """ users = accounts.find_users(cwruid=("=", "rxm")) self.assertEqual(len(users), 1) self.assertEqual(users[0], self.users[1])
def test_return_cwruid_match(self): """This method tests whether the find_users method will return the user matching the cwruid specified """ users = accounts.find_users(cwruid=('=', 'rxm')) self.assertEqual(len(users), 1) self.assertEqual(users[0], self.users[1])
def test_key(self): """This method verifies that the key method will return a key value """ testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] key = user.key() self.assertIsNotNone(key)
def test_key(self): """This method verifies that the key method will return a key value """ testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] key = user.key() self.assertIsNotNone(key)
def test_getattr_nochanges(self): """This method verifies that the __getattribute__ method will return the value of the corresponding attribute of internal User Model instance """ testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] self.assertEqual(user.cwruid, testid)
def test_return_limited(self): """This method tests whether the find_users will return a limited amount of users when limit is specified """ users = accounts.find_users(1) self.assertEqual(len(users), 1) self.assertIn(users[0], self.users)
def test_return_all_users(self): """This method tests whether find_users will return all users with no parameters """ users = accounts.find_users() self.assertEqual(len(users), 4) for user in users: self.assertIn(user, self.users)
def test_getattr_nochanges(self): """This method verifies that the __getattribute__ method will return the value of the corresponding attribute of internal User Model instance """ testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] self.assertEqual(user.cwruid, testid)
def service_inside_report(event_name, event_time): """ This view displays and processes inside service reports for the event specified by the url """ event = get_service_event(event_name, event_time) if event is None: return render_template('404.html'), 404 event = prepare_service_event(event) if request.method == 'POST': form = forms.ServiceReportForm() if form.validate(): new_report = models.InsideServiceReportModel(event=event) new_report.put() # now create the associated hour reports for hour_report in form.hour_reports: try: user = find_users(cwruid=('=', hour_report.cwruid.data))[0] except IndexError: continue # this user doesn't exist so skip it hours = None if hour_report.hours.data > 0: # filter bad hours data hours = hour_report.hours.data minutes = None if hour_report.minutes.data > 0: # filter bad minutes data minutes = hour_report.minutes.data if hours is None and minutes is None: continue # bad data so skip new_hour = models.ServiceHourModel(user=user.key(), report=new_report.key(), hours=hours, minutes=minutes) new_hour.put() return redirect( url_for('service_show_event', event_name=event.url_name, event_time=event.url_time)) else: flash(form.errors, 'error') else: form = create_inside_service_report_form(event) return render_template('service/submit_inside_report.html', form=form, event=event)
def handle_edit_contacts_phones_json(cwruid): """ This method handles the submission of the PhoneUpdateForm submitted from the display_edit_contacts view """ permissions = check_permissions(cwruid) if not permissions[0] and not permissions[1]: return jsonify({'result':'failure', 'msg':'Permission denied'}) try: user = find_users(1, cwruid=('=', cwruid))[0] except IndexError: return jsonify({'result':'failure', 'name':'main', 'errors': {}}) phones_form = forms.PhoneUpdateForm() if phones_form.validate(): query = models.PhoneModel.all() query.filter('user ='******'': name = None if phone_form.key.data == '': # create new phone phone = models.PhoneModel(user=user.key(), number=phone_form.phoneNumber.data, name=name) phone.put() else: # try and see what phone was updated index = None for i, phone in enumerate(phones): if str(phone.key()) == phone_form.key.data: phone.name = name phone.number = phone_form.phoneNumber.data phone.put() index = i break if index is not None: del phones[index] for phone in phones: phone.delete() else: # process errors errors = {} for i, phone_form in enumerate(phones_form.phones): for error in phone_form.errors: errors['phones-%i-%s' % (i, error)] = phone_form[str(error)].errors return jsonify({'result':'failure', 'name':'phones', 'errors': errors}) return jsonify({'result':'success'})
def test_return_multiple_match(self): """This method tests whether multiple users will be returned when multiple users are matched """ users = accounts.find_users(lname=('=', 'Marsh')) self.assertEqual(len(users), 2) for user in users: self.assertIn(user, self.users[1:3])
def view_user(cwruid): """ This view displays the profile information for the request cwruid """ try: user = find_users(limit=1, cwruid=('=',cwruid))[0] except IndexError: return render_template('404.html'), 404 show_edit_link = False permissions = check_permissions(cwruid) if permissions[0] or permissions[1]: show_edit_link = True minitial = '' if user.mname is not None and user.mname != '': minitial = user.mname[0].capitalize() + '.' avatar_address = '' if user.avatar is not None: avatar_address = user.avatar avatar = get_avatar_url(avatar_address, request.host_url, size=200) # get the email addresses associated with this user query = models.AddressModel.all() query.filter('user ='******'user ='******'user ='******'members/view.html', show_edit_link=show_edit_link, user=user, minitial=minitial, avatar=avatar, family=family, big=user.big, emails=emails, numbers=numbers, addresses=addresses)
def service_inside_report(event_name, event_time): """ This view displays and processes inside service reports for the event specified by the url """ event = get_service_event(event_name, event_time) if event is None: return render_template('404.html'), 404 event = prepare_service_event(event) if request.method == 'POST': form = forms.ServiceReportForm() if form.validate(): new_report = models.InsideServiceReportModel(event=event) new_report.put() # now create the associated hour reports for hour_report in form.hour_reports: try: user = find_users(cwruid=('=', hour_report.cwruid.data))[0] except IndexError: continue # this user doesn't exist so skip it hours = None if hour_report.hours.data > 0: # filter bad hours data hours = hour_report.hours.data minutes = None if hour_report.minutes.data > 0: # filter bad minutes data minutes = hour_report.minutes.data if hours is None and minutes is None: continue # bad data so skip new_hour = models.ServiceHourModel(user=user.key(), report=new_report.key(), hours=hours, minutes=minutes) new_hour.put() return redirect(url_for('service_show_event', event_name=event.url_name, event_time=event.url_time)) else: flash(form.errors,'error') else: form = create_inside_service_report_form(event) return render_template('service/submit_inside_report.html', form=form, event=event)
def test_return_multiple_match(self): """This method tests whether multiple users will be returned when multiple users are matched """ users = accounts.find_users(lname=("=", "Marsh")) self.assertEqual(len(users), 2) for user in users: self.assertIn(user, self.users[1:3])
def test_equal_wrong_obj(self): """This method verifies that an AttributeError is thrown when equal is compared with the wrong type""" testid = 'sxm1' user1 = accounts.find_users(cwruid=('=', testid))[0] class Fake(object): pass fake = Fake() self.assertFalse(user1 == fake)
def test_equal_wrong_obj(self): """This method verifies that an AttributeError is thrown when equal is compared with the wrong type""" testid = "sxm1" user1 = accounts.find_users(cwruid=("=", testid))[0] class Fake(object): pass fake = Fake() self.assertFalse(user1 == fake)
def view_user(cwruid): """ This view displays the profile information for the request cwruid """ try: user = find_users(limit=1, cwruid=('=', cwruid))[0] except IndexError: return render_template('404.html'), 404 show_edit_link = False permissions = check_permissions(cwruid) if permissions[0] or permissions[1]: show_edit_link = True minitial = '' if user.mname is not None and user.mname != '': minitial = user.mname[0].capitalize() + '.' avatar_address = '' if user.avatar is not None: avatar_address = user.avatar avatar = get_avatar_url(avatar_address, request.host_url, size=200) # get the email addresses associated with this user query = models.AddressModel.all() query.filter('user ='******'user ='******'user ='******'members/view.html', show_edit_link=show_edit_link, user=user, minitial=minitial, avatar=avatar, family=family, big=user.big, emails=emails, numbers=numbers, addresses=addresses)
def test_getattr_noexist(self): """This method verifies that the __getattribute__ method will raise an AttributeError if the request attribute doesn't exist""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] try: user.fake self.fail("Should have raised an AttributeError") except AttributeError: pass
def test_getattr_noexist(self): """This method verifies that the __getattribute__ method will raise an AttributeError if the request attribute doesn't exist""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] try: user.fake self.fail('Should have raised an AttributeError') except AttributeError: pass
def test_setattr_noexist(self): """This method verifies that the __setattr__ method will raise an AttributeError when the attribute being set doesn't exist""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] try: user.fake = 'fake' self.fail('Should raise an AttributeError') except AttributeError: pass
def test_getattr_noaccess(self): """This method verifies that the __getattribute__ method will raise an AttributeError if the request attribute is marked as non accessible in the User class""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] try: user.hash self.fail('Should have raised an AttributeError') except AttributeError: pass
def reset_password(): """ This view allows a user that has forgetten their password to request a new one via their case email account """ from application.generate_keys import generate_randomkey from google.appengine.api import mail form = forms.ResetPasswordForm(request.form) if request.method == 'POST' and form.validate(): try: user = accounts.find_users(1, cwruid=('=', form.cwruid.data))[0] new_password = generate_randomkey(16) user.set_new_password(new_password) body = """ Hi %s, Somebody requested a new password for you. You can now use %s when logging in. If you did not request this password change please contact the webmasters immediately. Thanks, The APO Website """ body %= (user.fname, new_password) mail.send_mail(sender="APO Website <*****@*****.**>", to="%s %s <*****@*****.**>" % (user.fname, user.lname, user.cwruid), subject='Your new password', body=body) except IndexError: pass flash( 'If an account with the specified cwru id exists then it should\ receive an email with a new password shortly', 'success') form = forms.ResetPasswordForm() return render_template('accounts/reset_password.html', reset_password_form=form)
def test_setattr_noexist(self): """This method verifies that the __setattr__ method will raise an AttributeError when the attribute being set doesn't exist""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] try: user.fake = "fake" self.fail("Should raise an AttributeError") except AttributeError: pass
def test_getattr_noaccess(self): """This method verifies that the __getattribute__ method will raise an AttributeError if the request attribute is marked as non accessible in the User class""" testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] try: user.hash self.fail("Should have raised an AttributeError") except AttributeError: pass
def reset_password(): """ This view allows a user that has forgetten their password to request a new one via their case email account """ from application.generate_keys import generate_randomkey from google.appengine.api import mail form = forms.ResetPasswordForm(request.form) if request.method == 'POST' and form.validate(): try: user = accounts.find_users(1, cwruid=('=', form.cwruid.data))[0] new_password = generate_randomkey(16) user.set_new_password(new_password) body = """ Hi %s, Somebody requested a new password for you. You can now use %s when logging in. If you did not request this password change please contact the webmasters immediately. Thanks, The APO Website """ body %= (user.fname, new_password) mail.send_mail(sender="APO Website <*****@*****.**>", to="%s %s <*****@*****.**>" % (user.fname, user.lname, user.cwruid), subject='Your new password', body=body) except IndexError: pass flash('If an account with the specified cwru id exists then it should\ receive an email with a new password shortly', 'success') form = forms.ResetPasswordForm() return render_template('accounts/reset_password.html', reset_password_form=form)
def test_setattr_nomod(self): """This method verifies that the __setattr__ method will not modify values marked as no modify in the User class """ testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] try: user.cwruid = "cwruid" self.fail("Should raise an AttributeError") except AttributeError: pass except: self.fail()
def test_setattr_nomod(self): """This method verifies that the __setattr__ method will not modify values marked as no modify in the User class """ testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] try: user.cwruid = 'cwruid' self.fail('Should raise an AttributeError') except AttributeError: pass except: self.fail()
def test_save(self): """This method verifies that the save method on the User class updates the attributes in the datastore """ testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] user.fname = 'Stanley' self.assertEqual(user.fname, u'Stanley') self.assertEqual(user._User__UserModel.fname, u'Stan') user.save() self.assertEqual(user.fname, 'Stanley') self.assertEqual(user._User__UserModel.fname, 'Stanley')
def test_save(self): """This method verifies that the save method on the User class updates the attributes in the datastore """ testid = "sxm1" user = accounts.find_users(cwruid=("=", testid))[0] user.fname = "Stanley" self.assertEqual(user.fname, u"Stanley") self.assertEqual(user._User__UserModel.fname, u"Stan") user.save() self.assertEqual(user.fname, "Stanley") self.assertEqual(user._User__UserModel.fname, "Stanley")
def test_rollback_all(self): """This method verifies that the rollback method will rollback all pending changes when no names are specified""" testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] # make some changes user.fname = 'Stanley' user.lname = 'March' self.assertEqual(user.fname, u'Stanley') self.assertEqual(user.lname, u'March') user.rollback() self.assertEqual(user.fname, u'Stan') self.assertEqual(user.lname, u'Marsh')
def test_rollback_multi(self): """This method verifies that the rollback method will rollback multiple pending parameters """ testid = 'sxm1' user = accounts.find_users(cwruid=('=', testid))[0] # set some "mistakes" user.fname = 'Stanley' user.lname = 'March' user.big = self.users[0].key() self.assertEqual(user.fname, u'Stanley') self.assertEqual(user.lname, u'March') self.assertEqual(user.big, self.users[0].key()) user.rollback('lname', 'big') self.assertEqual(user.fname, u'Stanley') self.assertEqual(user.lname, u'Marsh') self.assertEqual(user.big.key(), self.users[1].key())