def setUp(self): super(UserCanSignup, self).setUp() self.user_signing_up = User( (datetime.utcnow().strftime("%m-%d-%Y_%H.%M_%S") + '_test_account'), 'admin123', email='*****@*****.**', password_confirm='admin123')
def read_profile_information(self): username = self.read_user_name() first_name = self.read_text('#first-name') last_name = self.read_text('#last-name') email = self.read_text('#email') user = User(username=username, first_name=first_name, last_name=last_name, email=email) return user
def test_user_can_edit_profile_information(self): test_user = User(username=self.get_first_test_user().username, first_name=datetime.utcnow().strftime("%m-%d-%Y_%H.%M_%S") + 'First_name', last_name='Last_name', email='*****@*****.**') edited_test_user = (self.login_as(self.get_first_test_user()) .open_profile_dropdown() .open_edit_profile() .fill_new_profile_information(test_user) .navigate_to_home_page() .discard_leaving() .submit_edited_profile() .read_profile_information()) self.assertObjectsEqual(test_user, edited_test_user, "Profile is not edited")
def test_user_can_change_password(self): self.test_user = self.get_first_test_user() new_password = '******' username = (self.login_as(self.test_user) .open_change_password() .fill_new_password(self.test_user.password, new_password) .navigate_to_home_page() .discard_leaving() .change_password() .read_user_name() ) self.assertEqual(self.test_user.username, username, "User is logged out") ViewProfilePage().logout() user_with_changed_password = User(username=self.test_user.username, password=new_password) greeting = self.login_as(user_with_changed_password).read_greeting() self.assertIn(user_with_changed_password.username, greeting, "User is not logged in")
def get_third_test_user(self): if BaseTest.third_test_user is None: user = User('third_test_user', 'admin123') user.user_id = SQLHelper.create_user_if_not_present(user) BaseTest.third_test_user = user return BaseTest.third_test_user
def get_user_to_enter(self): return User(username=None, first_name=BaseTest.faker.first_name(), last_name=BaseTest.faker.last_name(), email=BaseTest.faker.email())